Meatpack::report_state on serial port init (#20903)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
ellensp
2021-01-28 20:47:12 +13:00
committed by Scott Lahteine
parent b10b76e882
commit 8da8e7d17b
10 changed files with 48 additions and 49 deletions

View File

@ -74,7 +74,6 @@ void MeatPack::reset_state() {
second_char = 0;
cmd_count = full_char_count = char_out_count = 0;
TERN_(MP_DEBUG, chars_decoded = 0);
report_state();
}
/**
@ -189,7 +188,7 @@ void MeatPack::report_state() {
* Interpret a single character received from serial
* according to the current meatpack state.
*/
void MeatPack::handle_rx_char(const uint8_t c) {
void MeatPack::handle_rx_char(const uint8_t c, const serial_index_t serial_ind) {
if (c == kCommandByte) { // A command (0xFF) byte?
if (cmd_count) { // In fact, two in a row?
cmd_is_next = true; // Then a MeatPack command follows
@ -201,6 +200,7 @@ void MeatPack::handle_rx_char(const uint8_t c) {
}
if (cmd_is_next) { // Were two command bytes received?
PORT_REDIRECT(serial_ind);
handle_command((MeatPack_Command)c); // Then the byte is a MeatPack command
cmd_is_next = false;
return;

View File

@ -101,7 +101,7 @@ private:
// Pass in a character rx'd by SD card or serial. Automatically parses command/ctrl sequences,
// and will control state internally.
static void handle_rx_char(const uint8_t c);
static void handle_rx_char(const uint8_t c, const serial_index_t serial_ind);
/**
* After passing in rx'd char using above method, call this to get characters out.

View File

@ -157,7 +157,7 @@ public:
#elif CUTTER_UNIT_IS(RPM)
2
#else
#error "CUTTER_UNIT_IS(???)"
#error "CUTTER_UNIT_IS(unknown)"
#endif
));
}