Make ptdump command async: Main loop will continue if comamnd is called

This commit is contained in:
2020-05-09 20:40:31 +02:00
parent 8f2418eb7c
commit 4f05c084d9
2 changed files with 19 additions and 45 deletions

View File

@@ -207,6 +207,8 @@ int main()
while (1) {
sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted);
snprintf(&disp[0][0], 17, "SD %smounted", sd_card_mounted ? "" : "un");
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
if (systick_ticks_have_passed(pid_timestamp, 250)) {
@@ -228,20 +230,22 @@ int main()
loudspeaker_set(1);
} else if (pid_controller_active) {
/* In case temperature measuremnt is okay and controlelr is working, write output power */
oven_driver_set_power(pid_controller_output < 0 ? 0U : pid_controller_output);
oven_driver_set_power(pid_controller_output < 0 ? 0U : (uint8_t)pid_controller_output);
}
button = button_read_event();
rot = rotary_encoder_get_abs_val();
/* TODO: handle gui */
snprintf(&disp[1][0], 17, "Rotary: %u", (unsigned int)rot);
snprintf(&disp[2][0], 17, "Button: %s", (button == BUTTON_SHORT ? "SHORT" : (button == BUTTON_LONG ? "LONG" : "")));
/* Handle uart input for shell */
uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len);
if (uart_receive_status >= 1)
if (uart_receive_status >= 0)
shell_handle_input(shell_handle, uart_input, uart_input_len);
if (systick_ticks_have_passed(display_timestamp, 1) || lcd_ret == LCD_FSM_CALL_AGAIN) {
if (systick_ticks_have_passed(display_timestamp, 2) || lcd_ret == LCD_FSM_CALL_AGAIN) {
lcd_ret = lcd_fsm_write_buffer(disp);
display_timestamp = systick_get_global_tick();
}