From a855b0621ea79d9eca1dceb9e33ba102d0bc5506 Mon Sep 17 00:00:00 2001 From: haoran Date: Fri, 30 Aug 2024 13:11:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=81=AF=E9=97=AA=E7=83=81?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E6=9C=AA=E8=BF=9E=E6=8E=A5=E9=BB=84=E8=89=B2?= =?UTF-8?q?=E9=97=AA=E7=83=81=E8=BF=9E=E6=8E=A5=E7=BB=BF=E8=89=B2=E5=B8=B8?= =?UTF-8?q?=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .settings/language.settings.xml | 4 ++-- usrc/main.cpp | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) 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");