Merge branch 'upstreamedge' into fix/inverse-transform
authorJim Morris <morris@wolfman.com>
Thu, 22 Sep 2016 05:42:00 +0000 (22:42 -0700)
committerJim Morris <morris@wolfman.com>
Thu, 22 Sep 2016 05:42:00 +0000 (22:42 -0700)
src/modules/utils/panel/screens/ModifyValuesScreen.cpp
src/modules/utils/panel/screens/ModifyValuesScreen.h
src/modules/utils/panel/screens/cnc/WatchScreen.cpp

index 85987cf..00c559b 100644 (file)
@@ -26,6 +26,7 @@ ModifyValuesScreen::ModifyValuesScreen(bool delete_on_exit)
     this->delete_on_exit= delete_on_exit;
     this->execute_function = -1;
     this->control_mode = MENU_CONTROL_MODE;
+    this->exit_screen_in_main_loop= false;
 }
 
 ModifyValuesScreen::~ModifyValuesScreen()
@@ -68,7 +69,12 @@ void ModifyValuesScreen::on_refresh()
             this->new_value = THEPANEL->get_control_value();
             if(!this->instant) execute_function= selected_item; // this causes on_main_loop to change the value
             if(menu_items.size() == 1) {
-                THEPANEL->enter_screen(this->parent);
+                if(this->instant) {
+                    THEPANEL->enter_screen(this->parent);
+                }else{
+                    // if we exit here then on_main_loop never gets run so we flag it to exit after setting the value
+                    exit_screen_in_main_loop= true;
+                }
 
             }else{
                 this->control_mode = MENU_CONTROL_MODE;
@@ -148,6 +154,7 @@ void ModifyValuesScreen::on_main_loop()
     // execute the setter function for the specified menu item
     std::get<2>(menu_items[execute_function])(this->new_value);
     execute_function = -1;
+    if(exit_screen_in_main_loop) THEPANEL->enter_screen(this->parent);
 }
 
 void ModifyValuesScreen::addMenuItem(const MenuItemType& item)
index 2c6c69c..d1dd436 100644 (file)
@@ -46,6 +46,7 @@ private:
     struct {
         bool delete_on_exit:1;
         bool instant:1;
+        bool exit_screen_in_main_loop:1;
     };
 
 };
index 041c2f5..84e3a09 100644 (file)
@@ -198,7 +198,7 @@ void WatchScreen::display_menu_line(uint16_t line)
                 #ifndef NO_TOOLS_LASER
                 Laser *plaser= nullptr;
                 if(PublicData::get_value(laser_checksum, (void *)&plaser) && plaser != nullptr) {
-                    THEPANEL->lcd->printf("Laser S%1.4f/%1.4f", THEROBOT->get_s_value(), plaser->get_current_power());
+                    THEPANEL->lcd->printf("Laser S%1.4f/%1.2f%%", THEROBOT->get_s_value(), plaser->get_current_power());
                 }
                 #endif
             }