More clarity

This commit is contained in:
Ulysse Cura 2026-02-09 18:28:19 +01:00
parent c4c53f8b12
commit 08e3658276
2 changed files with 12 additions and 12 deletions

View File

@ -42,21 +42,20 @@ void controller_init(void)
static inline void update_time(void)
{
static float last_time = 0.0;
float start_time = (float)clock() * 1000.0f / (float)CLOCKS_PER_SEC;
controller.delta_time_ms = start_time - last_time;
last_time = start_time;
static float last_time_ms = 0.0;
float start_time_ms = (float)clock() * 1000.0f / (float)CLOCKS_PER_SEC;
controller.delta_time_ms = start_time_ms - last_time_ms;
last_time_ms = start_time_ms;
static float elapsed_time = 0.0f;
elapsed_time += controller.delta_time_ms;
static float elapsed_time_ms = 0.0f;
elapsed_time_ms += controller.delta_time_ms;
static bool led_state = false;
if(elapsed_time >= 1000.0f)
if(elapsed_time_ms >= 1000.0f)
{
elapsed_time = 0.0f;
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_state);
elapsed_time_ms = 0.0f;
led_state = !led_state;
}
}
@ -77,4 +76,8 @@ void controller_handle_inputs_outputs(void)
void controller_deinit(void)
{
udp_server_deinit();
dhcp_server_deinit();
cyw43_arch_deinit();
}

View File

@ -14,10 +14,7 @@ int wifi_operator_init(void)
}
cyw43_arch_enable_ap_mode(WIFI_OPERATOR_SSID, WIFI_OPERATOR_PASSWORD, CYW43_AUTH_WPA2_AES_PSK);
cyw43_wifi_ap_set_channel(&cyw43_state, WIFI_OPERATOR_CHANNEL);
puts("AP mode enabled");
return 0;
}