diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 3eda1dc..e0b3693 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/usrc/main.cpp b/usrc/main.cpp index f6ad5bf..766e422 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -42,14 +42,14 @@ xs_gpio_t m_power_led1; xs_gpio_t m_power_led2; void power_light_init() { - xs_gpio_init_as_output(&m_power_led0, PB6, kxs_gpio_nopull, false, true); // r - xs_gpio_init_as_output(&m_power_led1, PB7, kxs_gpio_nopull, false, true); // g - xs_gpio_init_as_output(&m_power_led2, PB8, kxs_gpio_nopull, false, true); // b + xs_gpio_init_as_output(&m_power_led0, PB6, kxs_gpio_nopull, true, false); // r + xs_gpio_init_as_output(&m_power_led1, PB7, kxs_gpio_nopull, true, false); // g + xs_gpio_init_as_output(&m_power_led2, PB8, kxs_gpio_nopull, true, false); // y } -void power_light_ctrl(bool state) { +void power_light_ctrl(int green, int yellow) { xs_gpio_write(&m_power_led0, 0); - xs_gpio_write(&m_power_led1, state); - xs_gpio_write(&m_power_led2, state); + xs_gpio_write(&m_power_led1, green); + xs_gpio_write(&m_power_led2, yellow); } extern "C" { @@ -59,13 +59,13 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { ReportGeneratorService_irq_trig void debug_light_ctrl() { static uint32_t lastcall = 0; static bool light_status = false; - if (xs_has_passedms(lastcall) > 80) { + if (xs_has_passedms(lastcall) > 200) { light_status = !light_status; xs_gpio_write(&m_debug_led, light_status); if (network_service_network_is_ready()) { - power_light_ctrl(1); + power_light_ctrl(1,0); } else { - power_light_ctrl(light_status); + power_light_ctrl(0,light_status); } lastcall = xs_get_ticket(); } @@ -91,9 +91,9 @@ void factory_reset_key_detect() { // m_power_led while (xs_gpio_read(&m_factory_reset_key)) { - power_light_ctrl(false); + power_light_ctrl(false,false); osDelay(1000); - power_light_ctrl(true); + power_light_ctrl(true,false); osDelay(1000); } ZLOGI(TAG, "system reset");