#include "libs/StreamOutput.h"
#include <string>
-#include <vector>
+#include <deque>
using namespace std;
// static as it is shared by all screens
-std::vector<std::string> PanelScreen::command_queue;
+std::deque<std::string> PanelScreen::command_queue;
PanelScreen::PanelScreen() {}
PanelScreen::~PanelScreen() {}
void PanelScreen::on_main_loop()
{
// for each command in queue send it
- for (auto& cmd : command_queue) {
+ while(command_queue.size() > 0) {
struct SerialMessage message;
- message.message = cmd;
+ message.message = command_queue.front();
+ command_queue.pop_front();
message.stream = &(StreamOutput::NullStream);
THEKERNEL->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
- cmd.clear();
}
command_queue.clear();
}
#define PANELSCREEN_H
#include <string>
-#include <vector>
+#include <deque>
class Panel;
void send_gcode(std::string g);
void send_gcode(const char *gm_code, char parameter, float value);
void send_command(const char *gcstr);
- static std::vector<std::string> command_queue;
+ static std::deque<std::string> command_queue;
PanelScreen *parent;
};