X-Git-Url: http://git.hcoop.net/clinton/Smoothieware.git/blobdiff_plain/33e4cc023f2bb59ed79ccab37df01b2c1b5fdaf3..f6542ad9b2130bf22cdfb3677cdda336f09f0901:/src/libs/Kernel.h diff --git a/src/libs/Kernel.h b/src/libs/Kernel.h index c8f0fc4e..6ddd6fa6 100644 --- a/src/libs/Kernel.h +++ b/src/libs/Kernel.h @@ -7,29 +7,31 @@ #ifndef KERNEL_H #define KERNEL_H -#include "libs/Module.h" -#include "libs/Config.h" -#include "libs/SlowTicker.h" -#include "libs/StreamOutputPool.h" -#include "libs/StepTicker.h" -#include "libs/Adc.h" -#include "libs/Pauser.h" -#include "libs/PublicData.h" -#include "modules/communication/SerialConsole.h" -#include "modules/communication/GcodeDispatch.h" -#include "modules/tools/toolsmanager/ToolsManager.h" -#include "modules/robot/Planner.h" -#include "modules/robot/Robot.h" -#include "modules/robot/Stepper.h" -#include #define THEKERNEL Kernel::instance +#define THECONVEYOR THEKERNEL->conveyor + +#include "Module.h" +#include +#include +#include //Module manager class Config; class Module; class Conveyor; class SlowTicker; +class SerialConsole; +class StreamOutputPool; +class GcodeDispatch; +class Robot; +class Planner; +class StepTicker; +class Adc; +class PublicData; +class SimpleShell; +class Configurator; + class Kernel { public: Kernel(); @@ -37,32 +39,51 @@ class Kernel { const char* config_override_filename(){ return "/sd/config-override"; } void add_module(Module* module); - void register_for_event(_EVENT_ENUM id_event, Module* module); - void call_event(_EVENT_ENUM id_event); - void call_event(_EVENT_ENUM id_event, void * argument); + void register_for_event(_EVENT_ENUM id_event, Module *module); + void call_event(_EVENT_ENUM id_event, void * argument= nullptr); + + bool kernel_has_event(_EVENT_ENUM id_event, Module *module); + void unregister_for_event(_EVENT_ENUM id_event, Module *module); - // These modules are aviable to all other modules + bool is_using_leds() const { return use_leds; } + bool is_halted() const { return halted; } + bool is_grbl_mode() const { return grbl_mode; } + bool is_ok_per_line() const { return ok_per_line; } + + void set_feed_hold(bool f) { feed_hold= f; } + bool get_feed_hold() const { return feed_hold; } + + std::string get_query_string(); + + // These modules are available to all other modules SerialConsole* serial; StreamOutputPool* streams; - GcodeDispatch* gcode_dispatch; Robot* robot; - Stepper* stepper; Planner* planner; Config* config; Conveyor* conveyor; - Pauser* pauser; - ToolsManager* toolsmanager; + Configurator* configurator; + SimpleShell* simpleshell; int debug; SlowTicker* slow_ticker; StepTicker* step_ticker; Adc* adc; - PublicData* public_data; - bool use_leds; + std::string current_path; + uint32_t base_stepping_frequency; + uint32_t acceleration_ticks_per_second; private: - std::array, NUMBER_OF_DEFINED_EVENTS> hooks; // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered + // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered + std::array, NUMBER_OF_DEFINED_EVENTS> hooks; + struct { + bool use_leds:1; + bool halted:1; + bool grbl_mode:1; + bool feed_hold:1; + bool ok_per_line:1; + }; };