Backports from MK3

- Remove attempted recovery from RX buffer full (just drop chars)
  - Use CRITICAL_SECTION in LCD menu sync
  - Remove M851 command and zprobe_zoffset (Use live-Z instead)
This commit is contained in:
Ted Hess 2018-01-18 14:21:33 -05:00
parent 05a31ff2da
commit bbf13db82a
5 changed files with 19 additions and 30 deletions

View File

@ -10,7 +10,7 @@
// Firmware version // Firmware version
#define FW_version "3.1.0" #define FW_version "3.1.0"
#define FW_local_variant 5 #define FW_local_variant 6
#define FW_report_version FW_version " r" STR(FW_local_variant) #define FW_report_version FW_version " r" STR(FW_local_variant)
#define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
@ -467,7 +467,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
//=========================================================================== //===========================================================================
// Custom M code points // Custom M code points
#define CUSTOM_M_CODES //#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES #ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15 #define Z_PROBE_OFFSET_RANGE_MIN -15

View File

@ -1199,8 +1199,7 @@ void setup()
card.initsd(); card.initsd();
if (eeprom_read_dword((uint32_t*)(EEPROM_TOP - 4)) == 0x0ffffffff && if (eeprom_read_dword((uint32_t*)(EEPROM_TOP - 4)) == 0x0ffffffff &&
eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff && eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff) {
eeprom_read_dword((uint32_t*)(EEPROM_TOP - 12)) == 0x0ffffffff) {
// Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board, // Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board,
// where all the EEPROM entries are set to 0x0ff. // where all the EEPROM entries are set to 0x0ff.
// Once a firmware boots up, it forces at least a language selection, which changes // Once a firmware boots up, it forces at least a language selection, which changes
@ -1468,21 +1467,12 @@ void get_command()
if (!cmdqueue_could_enqueue_back(MAX_CMD_SIZE - 1)) if (!cmdqueue_could_enqueue_back(MAX_CMD_SIZE - 1))
return; return;
bool rx_buffer_full = false; //flag that serial rx buffer is full
while (MYSERIAL.available() > 0) { while (MYSERIAL.available() > 0) {
if (MYSERIAL.available() == RX_BUFFER_SIZE - 1) { //compare number of chars buffered in rx buffer with rx buffer size
SERIAL_ECHOLNPGM("Full RX Buffer"); //if buffer was full, there is danger that reading of last gcode will not be completed
rx_buffer_full = true; //sets flag that buffer was full
}
char serial_char = MYSERIAL.read(); char serial_char = MYSERIAL.read();
if (selectedSerialPort == 1) {
selectedSerialPort = 0; TimeSent = millis();
MYSERIAL.write(serial_char); TimeNow = millis();
selectedSerialPort = 1;
}
TimeSent = millis();
TimeNow = millis();
if (serial_char < 0) if (serial_char < 0)
// Ignore extended ASCII characters. These characters have no meaning in the G-code apart from the file names // Ignore extended ASCII characters. These characters have no meaning in the G-code apart from the file names
@ -1636,13 +1626,6 @@ void get_command()
} }
} }
//add comment
if (rx_buffer_full == true && serial_count > 0) { //if rx buffer was full and string was not properly terminated
rx_buffer_full = false;
bufindw = bufindw - serial_count; //adjust tail of the buffer to prepare buffer for writing new command
serial_count = 0;
}
#ifdef SDSUPPORT #ifdef SDSUPPORT
if(!card.sdprinting || serial_count!=0){ if(!card.sdprinting || serial_count!=0){
// If there is a half filled buffer from serial line, wait until return before // If there is a half filled buffer from serial line, wait until return before
@ -5559,8 +5542,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
{ {
zprobe_zoffset = -value; // compare w/ line 278 of ConfigurationStore.cpp zprobe_zoffset = -value; // compare w/ line 278 of ConfigurationStore.cpp
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNRPGM(CAT4(MSG_ZPROBE_ZOFFSET, " ", MSG_OK,PSTR(""))); SERIAL_ECHOLN(CAT4(MSG_ZPROBE_ZOFFSET, " ", MSG_OK,PSTR("")));
SERIAL_PROTOCOLLN("");
} }
else else
{ {
@ -5576,7 +5558,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
else else
{ {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNRPGM(CAT2(MSG_ZPROBE_ZOFFSET, PSTR(" : "))); SERIAL_ECHO(CAT2(MSG_ZPROBE_ZOFFSET, PSTR(" : ")));
SERIAL_ECHO(-zprobe_zoffset); SERIAL_ECHO(-zprobe_zoffset);
SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLLN("");
} }

View File

@ -3077,7 +3077,7 @@ const char * const MSG_SILENT_MODE_ON_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_SILENT_MODE_ON_DE MSG_SILENT_MODE_ON_DE
}; };
const char MSG_SKEW_CORRECTION_EN[] PROGMEM = "Very small XY skew. Disable skew correction?"; const char MSG_SKEW_CORRECTION_EN[] PROGMEM = "Very little skew detected. Disable correction?";
const char * const MSG_SKEW_CORRECTION_LANG_TABLE[1] PROGMEM = { const char * const MSG_SKEW_CORRECTION_LANG_TABLE[1] PROGMEM = {
MSG_SKEW_CORRECTION_EN MSG_SKEW_CORRECTION_EN
}; };

View File

@ -364,10 +364,13 @@ uint8_t lcdDrawUpdate = 2; /* Set to none-zero when the LCD nee
// float raw_Ki, raw_Kd; // float raw_Ki, raw_Kd;
#endif #endif
static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder = 0, const bool feedback = true, bool reset_menu_state = true) { static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder = 0, const bool feedback = true, bool reset_menu_state = true)
{
CRITICAL_SECTION_START
if (currentMenu != menu) { if (currentMenu != menu) {
currentMenu = menu; currentMenu = menu;
encoderPosition = encoder; encoderPosition = encoder;
CRITICAL_SECTION_END
if (reset_menu_state) { if (reset_menu_state) {
// Resets the global shared C union. // Resets the global shared C union.
// This ensures, that the menu entered will find out, that it shall initialize itself. // This ensures, that the menu entered will find out, that it shall initialize itself.
@ -379,6 +382,8 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder = 0, const boo
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
lcd_set_custom_characters(menu == lcd_status_screen); lcd_set_custom_characters(menu == lcd_status_screen);
#endif #endif
} else {
CRITICAL_SECTION_END
} }
} }
@ -5189,8 +5194,10 @@ void lcd_sdcard_menu()
} \ } \
static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) \ static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) \
{ \ { \
CRITICAL_SECTION_START \
menuData.editMenuParentState.prevMenu = currentMenu; \ menuData.editMenuParentState.prevMenu = currentMenu; \
menuData.editMenuParentState.prevEncoderPosition = encoderPosition; \ menuData.editMenuParentState.prevEncoderPosition = encoderPosition; \
CRITICAL_SECTION_END \
\ \
lcdDrawUpdate = 2; \ lcdDrawUpdate = 2; \
menuData.editMenuParentState.editLabel = pstr; \ menuData.editMenuParentState.editLabel = pstr; \

View File

@ -21,7 +21,7 @@
[platformio] [platformio]
src_dir = ./Firmware src_dir = ./Firmware
lib_dir = /opt/arduino-1.8.5/libraries lib_dir = /opt/arduino-1.8.5/libraries
envs_dir = ./pbuild build_dir = ./pbuild
env_default = Prusa3D env_default = Prusa3D
[env:Prusa3D] [env:Prusa3D]