add a LED_HOT that gets set if the temp of hotend or bed is > 50C
authorJim Morris <morris@wolfman.com>
Sat, 27 Sep 2014 05:35:31 +0000 (22:35 -0700)
committerJim Morris <morris@wolfman.com>
Sat, 27 Sep 2014 05:35:31 +0000 (22:35 -0700)
viki2 set red led if hot blue led if not

src/modules/utils/panel/panels/LcdBase.h
src/modules/utils/panel/panels/ST7565.cpp
src/modules/utils/panel/screens/WatchScreen.cpp

index 8f01a76..a34c0b9 100644 (file)
@@ -17,6 +17,7 @@
 #define LED_FAN_ON    1
 #define LED_HOTEND_ON 2
 #define LED_BED_ON    3
+#define LED_HOT       4
 
 class Panel;
 
index e6325b8..0504ae6 100644 (file)
@@ -102,8 +102,8 @@ ST7565::ST7565() {
 
     this->red_led.from_string(THEKERNEL->config->value( panel_checksum, red_led_checksum)->by_default("nc")->as_string())->as_output();
     this->blue_led.from_string(THEKERNEL->config->value( panel_checksum, blue_led_checksum)->by_default("nc")->as_string())->as_output();
-    this->red_led.set(0);
-    this->blue_led.set(0);
+    this->red_led.set(false);
+    this->blue_led.set(true);
 
     // contrast
     this->contrast= THEKERNEL->config->value(panel_checksum, contrast_checksum)->by_default(9)->as_number();
@@ -380,8 +380,13 @@ void ST7565::buzz(long duration, uint16_t freq) {
 void ST7565::setLed(int led, bool onoff) {
     if(!is_viki2) return;
 
-    switch(led) {
-        case LED_HOTEND_ON: red_led.set(onoff); break;
-        case LED_BED_ON: blue_led.set(onoff); break;
+    if(led == LED_HOT){
+        if(onoff)  {
+            red_led.set(true);
+            blue_led.set(false);
+        }else{
+            red_led.set(false);
+            blue_led.set(true);
+        }
     }
 }
index cb80c68..6d134ee 100644 (file)
@@ -125,6 +125,7 @@ void WatchScreen::on_refresh()
         THEPANEL->lcd->setLed(LED_BED_ON, this->bedtarget > 0);
         THEPANEL->lcd->setLed(LED_HOTEND_ON, this->hotendtarget > 0);
         THEPANEL->lcd->setLed(LED_FAN_ON, this->fan_state);
+        THEPANEL->lcd->setLed(LED_HOT, this->hotendtemp > 50 || this->bedtemp > 40);
 
         if (THEPANEL->lcd->hasGraphics()) {
             // display the graphical icons below the status are