More clarity
This commit is contained in:
parent
c4c53f8b12
commit
08e3658276
|
|
@ -42,21 +42,20 @@ void controller_init(void)
|
||||||
|
|
||||||
static inline void update_time(void)
|
static inline void update_time(void)
|
||||||
{
|
{
|
||||||
static float last_time = 0.0;
|
static float last_time_ms = 0.0;
|
||||||
float start_time = (float)clock() * 1000.0f / (float)CLOCKS_PER_SEC;
|
float start_time_ms = (float)clock() * 1000.0f / (float)CLOCKS_PER_SEC;
|
||||||
controller.delta_time_ms = start_time - last_time;
|
controller.delta_time_ms = start_time_ms - last_time_ms;
|
||||||
last_time = start_time;
|
last_time_ms = start_time_ms;
|
||||||
|
|
||||||
static float elapsed_time = 0.0f;
|
static float elapsed_time_ms = 0.0f;
|
||||||
elapsed_time += controller.delta_time_ms;
|
elapsed_time_ms += controller.delta_time_ms;
|
||||||
|
|
||||||
static bool led_state = false;
|
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);
|
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_state);
|
||||||
|
|
||||||
|
elapsed_time_ms = 0.0f;
|
||||||
led_state = !led_state;
|
led_state = !led_state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -77,4 +76,8 @@ void controller_handle_inputs_outputs(void)
|
||||||
void controller_deinit(void)
|
void controller_deinit(void)
|
||||||
{
|
{
|
||||||
udp_server_deinit();
|
udp_server_deinit();
|
||||||
|
|
||||||
|
dhcp_server_deinit();
|
||||||
|
|
||||||
|
cyw43_arch_deinit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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_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);
|
cyw43_wifi_ap_set_channel(&cyw43_state, WIFI_OPERATOR_CHANNEL);
|
||||||
|
|
||||||
puts("AP mode enabled");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue