Add main loop counter
This commit is contained in:
parent
415979e211
commit
119aa1b0ff
@ -132,7 +132,7 @@ static bool mount_sd_card_if_avail(bool mounted)
|
|||||||
|
|
||||||
const char *oven_controller_hello_world = "Hello world :)\n";
|
const char *oven_controller_hello_world = "Hello world :)\n";
|
||||||
static volatile enum button_state button;
|
static volatile enum button_state button;
|
||||||
|
static volatile uint32_t main_loops_per_ms;
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
bool sd_card_mounted = false;
|
bool sd_card_mounted = false;
|
||||||
@ -142,6 +142,9 @@ int main()
|
|||||||
shellmatta_handle_t shell_handle;
|
shellmatta_handle_t shell_handle;
|
||||||
int uart_receive_status;
|
int uart_receive_status;
|
||||||
|
|
||||||
|
uint32_t main_loop_cnt = 0UL;
|
||||||
|
uint64_t ms_stamp = 0ULL;
|
||||||
|
|
||||||
static struct pid_controller pid;
|
static struct pid_controller pid;
|
||||||
uint64_t pid_timestamp = 0;
|
uint64_t pid_timestamp = 0;
|
||||||
|
|
||||||
@ -173,7 +176,11 @@ int main()
|
|||||||
pid_zero(&pid);
|
pid_zero(&pid);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
if (systick_get_global_tick() - ms_stamp >= 1) {
|
||||||
|
ms_stamp = systick_get_global_tick();
|
||||||
|
main_loops_per_ms = main_loop_cnt;
|
||||||
|
main_loop_cnt = 0UL;
|
||||||
|
}
|
||||||
sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted);
|
sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted);
|
||||||
|
|
||||||
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
||||||
@ -191,6 +198,8 @@ int main()
|
|||||||
uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len);
|
uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len);
|
||||||
if (uart_receive_status >= 1)
|
if (uart_receive_status >= 1)
|
||||||
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
||||||
|
|
||||||
|
main_loop_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user