From aa0dd2a962d3d87c23417c4effd2443ea8a8738e Mon Sep 17 00:00:00 2001 From: zhaohe <1013909206@qq.com> Date: Fri, 12 Aug 2022 12:02:31 +0800 Subject: [PATCH] update --- .gitmodules | 3 ++ APP/service/light_control_service.c | 84 +++++++++++++++++++++++++++++++++++++ APP/service/light_control_service.h | 25 +++++++++++ CMSIS | 2 +- dep/zsimple_timer | 1 + 5 files changed, 114 insertions(+), 1 deletion(-) create mode 160000 dep/zsimple_timer diff --git a/.gitmodules b/.gitmodules index 1fead1a..67cfedd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "CMSIS"] path = CMSIS url = zwsd@192.168.1.3:manufacturer_eastsoft/ES8P5066_CMSIS.git +[submodule "dep/zsimple_timer"] + path = dep/zsimple_timer + url = zwsd@192.168.1.3:zthird/zsimple_timer.git diff --git a/APP/service/light_control_service.c b/APP/service/light_control_service.c index 33b8db1..ead4b6d 100644 --- a/APP/service/light_control_service.c +++ b/APP/service/light_control_service.c @@ -1,4 +1,88 @@ +#include "light_control_service.h" + +#include "../../zes8p5066lib/systicket.h" +#include "../port.h" +static Page_t s_nowpage; + +typedef struct { + Page_t nowpage; + union { + struct { + // rgb状态指示灯 + bool status_light_r; + bool status_light_g; + bool status_light_b; + + //倒计时指示灯 + int countdown_num; //当前灯的数量 + int one_light_time; // + uint32_t countdown_ms; //当前灯代表的时间 + uint32_t flash_triggerTicket; //倒计时指示灯闪烁效果触发时间 + bool flash_triggered; //是否触发闪烁指示灯 + uint32_t flash_autoCloseTimeMs; //倒计时闪烁指示灯自动关闭时间 + + int count_light_flash_ticket; + + } p1; + struct { + int errorNum; + } p2; + } p; +} ModuleState_t; + +ModuleState_t m; + +void lcs_change_page(Page_t page) { + m.nowpage = page; + if (m.nowpage == kworkPage) { + port_led_r_set(m.p.p1.status_light_r); + port_led_g_set(m.p.p1.status_light_g); + port_led_b_set(m.p.p1.status_light_b); + } +} + +void lcs_count_donwload_light__set_one_light_time_min(int min) {} +void lcs_count_donwload_light__set_count_num(int num) {} +void lcs_count_donwload_light__trigger_flash(int lastfortime, bool retrigger) { + /** + * @brief 触发倒计时指示灯闪烁效果 + */ + m.p.p1.flash_triggerTicket = systicket_get_now_ms(); + m.p.p1.flash_triggered = true; + m.p.p1.flash_autoCloseTimeMs = lastfortime; +} +void lcs_status_light__set_color(bool r, bool g, bool b) { + m.p.p1.status_light_r = r; + m.p.p1.status_light_g = g; + m.p.p1.status_light_b = b; +} + +void lcs_error_light__set_error(int errorNum) {} +void lcs_error_light__clear_error(int errorNum) {} + +/*********************************************************************************************************************** + * =====================================================schedule====================================================== * + ***********************************************************************************************************************/ +void lcs_schedule_process() { + /** + * @brief + */ + + if (m.nowpage == kworkPage) { + if (m.p.p1.flash_triggered) { + } + } +} + +void lcs_shcedule() { + static uint32_t ticket = 0; + if (systicket_haspassedms(ticket) > 30) { + ticket = systicket_get_now_ms(); + lcs_schedule_process(); + } +} + #if 0 #include "light.h" static bool s_interval_working_mode; diff --git a/APP/service/light_control_service.h b/APP/service/light_control_service.h index e69de29..889cfdd 100644 --- a/APP/service/light_control_service.h +++ b/APP/service/light_control_service.h @@ -0,0 +1,25 @@ +#pragma once +// +#include +#include + +typedef enum { + kworkPage, + kerrorPage, +} Page_t; + +void lcs_change_page(Page_t page); + +/*********************************************************************************************************************** + * =====================================================workPage====================================================== * + ***********************************************************************************************************************/ +void lcs_count_donwload_light__set_one_light_time_min(int min) {} +void lcs_count_donwload_light__set_count_num(int num); +void lcs_count_donwload_light__trigger_flash(int lastfortime, bool retrigger); +void lcs_status_light__set_color(bool r, bool g, bool b); + +/*********************************************************************************************************************** + * =====================================================ErrorPage===================================================== * + ***********************************************************************************************************************/ +void lcs_error_light__set_error(int errorNum); +void lcs_error_light__clear_error(int errorNum); \ No newline at end of file diff --git a/CMSIS b/CMSIS index ebdb7af..97fbccc 160000 --- a/CMSIS +++ b/CMSIS @@ -1 +1 @@ -Subproject commit ebdb7afd574de627a718687547e86185a8a4f365 +Subproject commit 97fbccc0525041fe1ccfb714cfca2548495cc3a6 diff --git a/dep/zsimple_timer b/dep/zsimple_timer new file mode 160000 index 0000000..8fa826d --- /dev/null +++ b/dep/zsimple_timer @@ -0,0 +1 @@ +Subproject commit 8fa826d87b89370b8d4fd1f2e7a6bfdcc8e1a056