make the command queue static so it is shared by all screen instances
authorJim Morris <morris@wolfman.com>
Sun, 7 Dec 2014 20:49:24 +0000 (12:49 -0800)
committerJim Morris <morris@wolfman.com>
Sun, 7 Dec 2014 20:49:24 +0000 (12:49 -0800)
src/modules/utils/panel/PanelScreen.cpp
src/modules/utils/panel/PanelScreen.h

index 380b6ec..992065c 100644 (file)
@@ -20,6 +20,9 @@
 
 using namespace std;
 
+// static as it is shared by all screens
+std::vector<std::string> PanelScreen::command_queue;
+
 PanelScreen::PanelScreen() {}
 PanelScreen::~PanelScreen() {}
 
@@ -87,7 +90,7 @@ void PanelScreen::send_command(const char *gcstr)
 void PanelScreen::on_main_loop()
 {
     // for each command in queue send it
-    for (auto cmd : command_queue) {
+    for (auto& cmd : command_queue) {
         struct SerialMessage message;
         message.message = cmd;
         message.stream = &(StreamOutput::NullStream);
index 36934eb..b249dee 100644 (file)
@@ -37,7 +37,7 @@ protected:
     void send_gcode(std::string g);
     void send_gcode(const char *gm_code, char parameter, float value);
     void send_command(const char *gcstr);
-    std::vector<std::string> command_queue;
+    static std::vector<std::string> command_queue;
     PanelScreen *parent;
 };