optimisation: lcd avoid streams

Author: leptun

Change in memory:
Flash: -124 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-07-25 10:57:00 +00:00 committed by Guðni Már Gilbert
parent 5d880919f8
commit 5288d615f8
9 changed files with 21 additions and 29 deletions

View File

@ -822,7 +822,7 @@ void dcode_2130()
}
else if (strcmp(strchr_pointer + 7, "wave") == 0)
{
tmc2130_get_wave(axis, 0, stdout);
tmc2130_get_wave(axis, 0);
}
}
else if (strchr_pointer[1+5] == '!')

View File

@ -898,7 +898,8 @@ void update_sec_lang_from_external_flash()
if (lang_get_header(lang, &header, &src_addr))
{
lcd_puts_at_P(1,0,PSTR("Language update"));
for (uint8_t i = 0; i < state; i++) fputc('.', lcdout);
for (uint8_t i = 0; i < state; i++)
lcd_print('.');
_delay(100);
boot_reserved = (boot_reserved & 0xF8) | ((state + 1) & 0x07);
if ((state * LANGBOOT_BLOCKSIZE) < header.size)
@ -1441,7 +1442,7 @@ void setup()
uint16_t sec_lang_code = lang_get_code(1);
uint16_t ui = _SEC_LANG_TABLE; //table pointer
printf_P(_n("lang_selected=%d\nlang_table=0x%04x\nSEC_LANG_CODE=0x%04x (%c%c)\n"), lang_selected, ui, sec_lang_code, sec_lang_code >> 8, sec_lang_code & 0xff);
lang_print_sec_lang(uartout);
lang_print_sec_lang();
#endif //DEBUG_SEC_LANG
#endif //(LANG_MODE != 0)

View File

@ -6,19 +6,17 @@
#include <stdio.h>
extern FILE _uartout;
#define uartout (&_uartout)
extern void softReset();
void bootapp_print_vars(void)
{
fprintf_P(uartout, PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr);
fprintf_P(uartout, PSTR("boot_dst_addr =0x%08lx\n"), boot_dst_addr);
fprintf_P(uartout, PSTR("boot_copy_size =0x%04x\n"), boot_copy_size);
fprintf_P(uartout, PSTR("boot_reserved =0x%02x\n"), boot_reserved);
fprintf_P(uartout, PSTR("boot_app_flags =0x%02x\n"), boot_app_flags);
fprintf_P(uartout, PSTR("boot_app_magic =0x%08lx\n"), boot_app_magic);
printf_P(PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr);
printf_P(PSTR("boot_dst_addr =0x%08lx\n"), boot_dst_addr);
printf_P(PSTR("boot_copy_size =0x%04x\n"), boot_copy_size);
printf_P(PSTR("boot_reserved =0x%02x\n"), boot_reserved);
printf_P(PSTR("boot_app_flags =0x%02x\n"), boot_app_flags);
printf_P(PSTR("boot_app_magic =0x%08lx\n"), boot_app_magic);
}

View File

@ -276,7 +276,7 @@ const char* lang_get_sec_lang_str_by_id(uint16_t id)
return ui + pgm_read_word(((uint16_t*)(ui + 16 + id * 2))); //read relative offset and return calculated pointer
}
uint16_t lang_print_sec_lang(FILE* out)
uint16_t lang_print_sec_lang()
{
printf_P(_n("&_SEC_LANG = 0x%04x\n"), &_SEC_LANG);
printf_P(_n("sizeof(_SEC_LANG) = 0x%04x\n"), sizeof(_SEC_LANG));
@ -298,7 +298,7 @@ uint16_t lang_print_sec_lang(FILE* out)
puts_P(_n(" strings:\n"));
uint16_t ui = _SEC_LANG_TABLE; //table pointer
for (ui = 0; ui < _lt_count; ui++)
fprintf_P(out, _n(" %3d %S\n"), ui, lang_get_sec_lang_str_by_id(ui));
printf_P(_n(" %3d %S\n"), ui, lang_get_sec_lang_str_by_id(ui));
return _lt_count;
}
#endif //DEBUG_SEC_LANG

View File

@ -171,7 +171,7 @@ extern uint8_t lang_is_selected(void);
#ifdef DEBUG_SEC_LANG
extern const char* lang_get_sec_lang_str_by_id(uint16_t id);
extern uint16_t lang_print_sec_lang(FILE* out);
extern uint16_t lang_print_sec_lang();
#endif //DEBUG_SEC_LANG
extern void lang_boot_update_start(uint8_t lang);

View File

@ -100,10 +100,6 @@ static void pat9125_wr_reg(uint8_t addr, uint8_t data);
static uint8_t pat9125_wr_reg_verify(uint8_t addr, uint8_t data);
static uint8_t pat9125_wr_seq(const uint8_t* seq);
extern FILE _uartout;
#define uartout (&_uartout)
uint8_t pat9125_probe()
{
#if defined(PAT9125_SWI2C)

View File

@ -855,7 +855,7 @@ void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_u
}
}
void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream)
void tmc2130_get_wave(uint8_t axis, uint8_t* data)
{
uint8_t pwr = tmc2130_get_pwr(axis);
tmc2130_set_pwr(axis, 0);
@ -867,13 +867,10 @@ void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream)
uint32_t val = tmc2130_rd_MSCURACT(axis);
uint16_t mscnt = tmc2130_rd_MSCNT(axis);
int curA = (val & 0xff) | ((val << 7) & 0x8000);
if (stream)
{
if (mscnt == i)
fprintf_P(stream, PSTR("%d\t%d\n"), i, curA);
else //TODO - remove this check
fprintf_P(stream, PSTR("!! (i=%d MSCNT=%d)\n"), i, mscnt);
}
if (mscnt == i)
printf_P(PSTR("%d\t%d\n"), i, curA);
else //TODO - remove this check
printf_P(PSTR("!! (i=%d MSCNT=%d)\n"), i, mscnt);
if (data) *(data++) = curA;
tmc2130_do_step(axis);
delayMicroseconds(100);

View File

@ -139,7 +139,7 @@ extern void tmc2130_set_dir(uint8_t axis, uint8_t dir);
extern void tmc2130_do_step(uint8_t axis);
extern void tmc2130_do_steps(uint8_t axis, uint16_t steps, uint8_t dir, uint16_t delay_us);
extern void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_us, uint16_t microstep_resolution);
extern void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream);
extern void tmc2130_get_wave(uint8_t axis, uint8_t* data);
extern void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000);
extern bool tmc2130_home_calibrate(uint8_t axis);

View File

@ -3335,7 +3335,7 @@ static void lcd_crash_mode_info()
if ((tim + 1000) < _millis())
{
lcd_clear();
fputs_P(_i("Crash detection can\nbe turned on only in\nNormal mode"), lcdout);////MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4
lcd_puts_P(_i("Crash detection can\nbe turned on only in\nNormal mode"));////MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4
tim = _millis();
}
menu_back_if_clicked();
@ -3348,7 +3348,7 @@ static void lcd_crash_mode_info2()
if ((tim + 1000) < _millis())
{
lcd_clear();
fputs_P(_i("WARNING:\nCrash detection\ndisabled in\nStealth mode"), lcdout);////MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4
lcd_puts_P(_i("WARNING:\nCrash detection\ndisabled in\nStealth mode"));////MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4
tim = _millis();
}
menu_back_if_clicked();