turn on second serial line from settings menu

This commit is contained in:
PavelSindler 2017-12-08 16:56:06 +01:00
parent 07aa7a3803
commit 868aacc7d5
6 changed files with 35 additions and 2 deletions

View File

@ -81,6 +81,7 @@
#define EEPROM_POWER_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-17)
#define EEPROM_DIR_DEPTH (EEPROM_POWER_COUNT-1)
#define EEPROM_DIRS (EEPROM_DIR_DEPTH-80) //8 chars for each dir name, max 10 levels
#define EEPROM_SECOND_SERIAL_ACTIVE (EEPROM_DIRS - 1) //0: use only USART0; 1: use both USART0 and USART1
//TMC2130 configuration
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size

View File

@ -813,13 +813,14 @@ void setup()
EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == 0xFFFF)) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode
if (farm_no == 0xFFFF) farm_no = 0;
selectedSerialPort = eeprom_read_byte((uint8_t*)EEPROM_SECOND_SERIAL_ACTIVE);
if (selectedSerialPort == 0xFF) selectedSerialPort = 0;
if (farm_mode)
{
prusa_statistics(8);
selectedSerialPort = 1;
}
else
selectedSerialPort = 0;
MYSERIAL.begin(BAUDRATE);
fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
stdout = uartout;

View File

@ -1505,6 +1505,16 @@ const char * const MSG_SD_WRITE_TO_FILE_LANG_TABLE[1] PROGMEM = {
MSG_SD_WRITE_TO_FILE_EN
};
const char MSG_SECOND_SERIAL_OFF_EN[] PROGMEM = "2nd USART [off]";
const char * const MSG_SECOND_SERIAL_OFF_LANG_TABLE[1] PROGMEM = {
MSG_SECOND_SERIAL_OFF_EN
};
const char MSG_SECOND_SERIAL_ON_EN[] PROGMEM = "2nd USART [on]";
const char * const MSG_SECOND_SERIAL_ON_LANG_TABLE[1] PROGMEM = {
MSG_SECOND_SERIAL_ON_EN
};
const char MSG_SELFTEST_EN[] PROGMEM = "Selftest ";
const char * const MSG_SELFTEST_LANG_TABLE[1] PROGMEM = {
MSG_SELFTEST_EN

View File

@ -512,6 +512,10 @@ extern const char* const MSG_SD_WORKDIR_FAIL_LANG_TABLE[1];
#define MSG_SD_WORKDIR_FAIL LANG_TABLE_SELECT_EXPLICIT(MSG_SD_WORKDIR_FAIL_LANG_TABLE, 0)
extern const char* const MSG_SD_WRITE_TO_FILE_LANG_TABLE[1];
#define MSG_SD_WRITE_TO_FILE LANG_TABLE_SELECT_EXPLICIT(MSG_SD_WRITE_TO_FILE_LANG_TABLE, 0)
extern const char* const MSG_SECOND_SERIAL_OFF_LANG_TABLE[1];
#define MSG_SECOND_SERIAL_OFF LANG_TABLE_SELECT_EXPLICIT(MSG_SECOND_SERIAL_OFF_LANG_TABLE, 0)
extern const char* const MSG_SECOND_SERIAL_ON_LANG_TABLE[1];
#define MSG_SECOND_SERIAL_ON LANG_TABLE_SELECT_EXPLICIT(MSG_SECOND_SERIAL_ON_LANG_TABLE, 0)
extern const char* const MSG_SELFTEST_LANG_TABLE[1];
#define MSG_SELFTEST LANG_TABLE_SELECT_EXPLICIT(MSG_SELFTEST_LANG_TABLE, 0)
extern const char* const MSG_SELFTEST_AXIS_LANG_TABLE[LANG_NUM];

View File

@ -370,3 +370,6 @@
#define(length=20, lines=2) MSG_UNLOAD_SUCCESSFULL "Repeat unloading filament?"
#define(length=20, lines=2) MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?"
#define(length=17, lines=1) MSG_SECOND_SERIAL_ON "2nd USART [on]"
#define(length=17, lines=1) MSG_SECOND_SERIAL_OFF "2nd USART [off]"

View File

@ -3330,6 +3330,13 @@ void lcd_temp_calibration_set() {
lcd_goto_menu(lcd_settings_menu, 10);
}
void lcd_second_serial_set() {
if(selectedSerialPort == 1) selectedSerialPort = 0;
else selectedSerialPort = 1;
eeprom_update_byte((unsigned char *)EEPROM_SECOND_SERIAL_ACTIVE, selectedSerialPort);
lcd_goto_menu(lcd_settings_menu, 11);
}
void lcd_calibrate_pinda() {
enquecommand_P(PSTR("G76"));
lcd_return_to_status();
@ -3688,6 +3695,13 @@ static void lcd_settings_menu()
else {
MENU_ITEM(function, MSG_TEMP_CALIBRATION_ON, lcd_temp_calibration_set);
}
if (selectedSerialPort == false) {
MENU_ITEM(function, MSG_SECOND_SERIAL_OFF, lcd_second_serial_set);
}
else {
MENU_ITEM(function, MSG_SECOND_SERIAL_ON, lcd_second_serial_set);
}
if (SilentModeMenu == 0) {
MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set);
}