добавлено моргание диода каждую секунду

This commit is contained in:
2026-04-12 10:56:43 +03:00
parent 76bbd4a539
commit f0f5f625e9
93 changed files with 417 additions and 7068 deletions

View File

@@ -26,10 +26,15 @@ void ClockManager_Init(void) {
}
}
time_t ClockManager_GetTime(void) {
time_t ClockManager_GetTime(int blink) {
HAL_RTC_GetTime(&hrtc, &rtc_time, RTC_FORMAT_BIN);
currentTime.hour = rtc_time.Hours;
currentTime.min = rtc_time.Minutes;
if(blink)
{
if(currentTime.sec != rtc_time.Seconds)
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
}
currentTime.sec = rtc_time.Seconds;
return currentTime;
}

View File

@@ -9,7 +9,7 @@
void ClockManager_Init(void);
// Получить текущее время из RTC
time_t ClockManager_GetTime(void);
time_t ClockManager_GetTime(int blink);
// Установить время в RTC
void ClockManager_SetTime(uint8_t hour, uint8_t min, uint8_t sec);

View File

@@ -71,7 +71,7 @@ static void FormatTime(char* buf, const time_t* t) {
static void UpdateDisplay(void) {
switch (menu.state) {
case STATE_CLOCK: {
time_t now = ClockManager_GetTime();
time_t now = ClockManager_GetTime(1);
char buf[7];
FormatTime(buf, &now);
Segment_SetString(buf);
@@ -251,7 +251,7 @@ static void ProcessButton(Button_Type btn, bool longPress) {
switch (menu.selectedMenuItem) {
case MAIN_MENU_SET_TIME:
menu.state = STATE_SET_TIME;
menu.originalTime = ClockManager_GetTime();
menu.originalTime = ClockManager_GetTime(0);
menu.editTime = menu.originalTime;
menu.editStep = 0;
menu.blinkState = true;