# automatically toggle a switch at a specified temperature
# useful to turn on a fan or water pump to cool the hotend
-#temperatureswitch_module_enable true #
+#temperatureswitch.hotend.enable true #
#temperatureswitch.hotend.type misc # select which MOSFET to use, fan or misc (small MOSFETs)
#temperatureswitch.hotend.threshold_temp 60.0 # temperature to turn on (if rising) or off the switch
#temperatureswitch.hotend.heatup_poll 15 # poll heatup at 15 sec intervals
# automatically toggle a switch at a specified temperature
# useful to turn on a fan or water pump to cool the hotend
-#temperatureswitch_module_enable true #
+#temperatureswitch.hotend.enable true #
#temperatureswitch.hotend.type misc # select which MOSFET to use, fan or misc (small MOSFETs)
#temperatureswitch.hotend.threshold_temp 60.0 # temperature to turn on (if rising) or off the switch
#temperatureswitch.hotend.heatup_poll 15 # poll heatup at 15 sec intervals
# automatically toggle a switch at a specified temperature
# useful to turn on a fan or water pump to cool the hotend
-#temperatureswitch_module_enable true #
+#temperatureswitch.hotend.enable true #
#temperatureswitch.hotend.type misc # select which MOSFET to use, fan or misc (small MOSFETs)
#temperatureswitch.hotend.threshold_temp 60.0 # temperature to turn on (if rising) or off the switch
#temperatureswitch.hotend.heatup_poll 15 # poll heatup at 15 sec intervals
# automatically toggle a switch at a specified temperature
# useful to turn on a fan or water pump to cool the hotend
-#temperatureswitch_module_enable true #
+#temperatureswitch.hotend.enable true #
#temperatureswitch.hotend.type misc # select which MOSFET to use, fan or misc (small MOSFETs)
#temperatureswitch.hotend.threshold_temp 60.0 # temperature to turn on (if rising) or off the switch
#temperatureswitch.hotend.heatup_poll 15 # poll heatup at 15 sec intervals
#ifndef NONETWORK
kernel->add_module( new Network() );
#endif
- #ifndef NO_TOOLS_TEMPERATURESWITCH
- kernel->add_module( new TemperatureSwitch() );
- #endif
+ #ifndef NO_TOOLS_TEMPERATURESWITCH
+ kernel->add_module( new TemperatureSwitch() );
+ #endif
// Create and initialize USB stuff
u.init();
#include "PublicData.h"
#include "StreamOutputPool.h"
+#define temperatureswitch_checksum CHECKSUM("temperatureswitch")
+#define temperatureswitch_enable_checksum CHECKSUM("enable")
+#define temperatureswitch_hotend_checksum CHECKSUM("hotend")
+#define temperatureswitch_threshold_temp_checksum CHECKSUM("threshold_temp")
+#define temperatureswitch_type_checksum CHECKSUM("type")
+#define temperatureswitch_heatup_poll_checksum CHECKSUM("heatup_poll")
+#define temperatureswitch_cooldown_poll_checksum CHECKSUM("cooldown_poll")
+
TemperatureSwitch::TemperatureSwitch()
{
}
void TemperatureSwitch::on_module_loaded()
{
// free up space if not loaded
- if (!THEKERNEL->config->value(temperatureswitch_module_enable_checksum)->by_default(false)->as_bool()) {
+ if (!THEKERNEL->config->value(temperatureswitch_checksum, temperatureswitch_hotend_checksum, temperatureswitch_enable_checksum)->by_default(false)->as_bool()) {
delete this;
return;
}
{
// save the list of temperature controllers
THEKERNEL->config->get_module_list(&temp_controllers, temperature_control_checksum);
+ if (temp_controllers.empty()) {
+ delete this;
+ return;
+ }
// load settings from config file
this->temperatureswitch_state = false;
#include <string>
#include <vector>
-#define temperatureswitch_module_enable_checksum CHECKSUM("temperatureswitch_module_enable")
-#define temperatureswitch_checksum CHECKSUM("temperatureswitch")
-#define temperatureswitch_hotend_checksum CHECKSUM("hotend")
-#define temperatureswitch_threshold_temp_checksum CHECKSUM("threshold_temp")
-#define temperatureswitch_type_checksum CHECKSUM("type")
-#define temperatureswitch_heatup_poll_checksum CHECKSUM("heatup_poll")
-#define temperatureswitch_cooldown_poll_checksum CHECKSUM("cooldown_poll")
-
class TemperatureSwitch : public Module
{
public: