225 lines
8.0 KiB
C
225 lines
8.0 KiB
C
|
|
/* USER CODE BEGIN Header */
|
|||
|
|
/**
|
|||
|
|
******************************************************************************
|
|||
|
|
* @file fm33lg0xx_fl_common.c
|
|||
|
|
* @author Motor Control SDK Team, Yuwell Software XiangenWang
|
|||
|
|
* @brief Voice Recognition Module Initialization Section,
|
|||
|
|
including peripheral initialization and message node insertion, etc.
|
|||
|
|
* @version 1.0
|
|||
|
|
* @changelog version 1.0 <EFBFBD><EFBFBD>ʼ<EFBFBD>汾 2025.11.13
|
|||
|
|
- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>в<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
******************************************************************************
|
|||
|
|
* @attention
|
|||
|
|
*
|
|||
|
|
* <h2><center>© Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China.
|
|||
|
|
* All rights reserved.</center></h2>
|
|||
|
|
*
|
|||
|
|
* Redistribution and use in source and binary forms, with or without
|
|||
|
|
* modification, are permitted, provided that the following conditions are met:
|
|||
|
|
*
|
|||
|
|
* 1. Redistribution of source code must retain the above copyright notice,
|
|||
|
|
* this list of conditions and the following disclaimer.
|
|||
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|||
|
|
* this list of conditions and the following disclaimer in the documentation
|
|||
|
|
* and/or other materials provided with the distribution.
|
|||
|
|
* 3. Neither the name of Yuwell Software nor the names of other
|
|||
|
|
* contributors to this software may be used to endorse or promote products
|
|||
|
|
* derived from this software without specific written permission.
|
|||
|
|
* 4. This software, including modifications and/or derivative works of this
|
|||
|
|
* software, must execute solely and exclusively on microcontroller or
|
|||
|
|
* microprocessor devices manufactured by or for Yuwell Software.
|
|||
|
|
* 5. Redistribution and use of this software other than as permitted under
|
|||
|
|
* this license is void and will automatically terminate your rights under
|
|||
|
|
* this license.
|
|||
|
|
*
|
|||
|
|
* THIS SOFTWARE IS PROVIDED BY Yuwell Software AND CONTRIBUTORS "AS IS"
|
|||
|
|
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
|||
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|||
|
|
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
|||
|
|
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
|||
|
|
* SHALL Yuwell Software OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|||
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|||
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|||
|
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|||
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|||
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|||
|
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
|
*
|
|||
|
|
******************************************************************************
|
|||
|
|
*/
|
|||
|
|
/* USER CODE END Header */
|
|||
|
|
#include "fm33lg0xx_fl_common.h"
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
void total_time_record_task(void)
|
|||
|
|
{
|
|||
|
|
static uint16_t ms_count = 0;
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC><EFBFBD>ο<EFBFBD><CEBF><EFBFBD><EFBFBD>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD>е<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
static uint32_t current_seconds = 0;
|
|||
|
|
static uint32_t current_minutes = 0;
|
|||
|
|
static uint32_t current_hours = 0;
|
|||
|
|
|
|||
|
|
MsgQueueItem queue_item_time_send;
|
|||
|
|
MsgQueueItem qitem_current_time_modify;
|
|||
|
|
MsgQueueItem filter_item;
|
|||
|
|
|
|||
|
|
if(ms_count < 10) // <20>ں<EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>ʱ 1<><31><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>һ<EFBFBD><D2BB>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
|||
|
|
{
|
|||
|
|
ms_count++;
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
ms_count = 0;
|
|||
|
|
if(ui.disp_info.work_seconds < 59)
|
|||
|
|
{
|
|||
|
|
ui.disp_info.work_seconds++;
|
|||
|
|
}else{
|
|||
|
|
ui.disp_info.work_seconds = 0;
|
|||
|
|
|
|||
|
|
if(ui.disp_info.work_minutes < 59)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
ui.disp_info.work_minutes++;
|
|||
|
|
queue_item_time_send.type = MSG_TYPE_MINUTE_SAVE;
|
|||
|
|
queue_item_time_send.data.hour_meter.minute = ui.disp_info.work_minutes;
|
|||
|
|
insert_queue_node_in_head(&global_queue, queue_item_time_send); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>Ϣ
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
ui.disp_info.work_minutes = 1;
|
|||
|
|
queue_item_time_send.type = MSG_TYPE_MINUTE_SAVE;
|
|||
|
|
queue_item_time_send.data.hour_meter.minute = ui.disp_info.work_minutes;
|
|||
|
|
insert_queue_node_in_head(&global_queue, queue_item_time_send); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>Ϣ
|
|||
|
|
|
|||
|
|
ui.disp_info.work_hours++;
|
|||
|
|
queue_item_time_send.type = MSG_TYPE_HOUR_SAVE;
|
|||
|
|
queue_item_time_send.data.hour_meter.hour = ui.disp_info.work_hours;
|
|||
|
|
insert_queue_node_in_head(&global_queue, queue_item_time_send); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>һ<EFBFBD><D2BB>Сʱ<D0A1><CAB1><EFBFBD>洢<EFBFBD><E6B4A2>Ϣ
|
|||
|
|
|
|||
|
|
|
|||
|
|
peek_queue_node_by_type(&global_queue, MSG_TYPE_FILTER_SERVER, &filter_item);
|
|||
|
|
|
|||
|
|
// 1800Сʱ<D0A1><CAB1>һ<EFBFBD><D2BB><EFBFBD>˺С<CBBA>100Сʱ<D0A1><CAB1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ֱ<EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʾ<EFBFBD>ȴ<EFBFBD><C8B4>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
if(ui.disp_info.work_hours%100 == 0) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>100Сʱ
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if(ui.disp_info.work_hours%1800 == 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if((ui.disp_info.work_hours > filter_item.data.filter_server.last_replace_filter_hours)&&
|
|||
|
|
!xOxygenEventGroupCheckBit(&global_event, EVENT_REPLACE_FILTER_NOTIFY))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
vOxygenEventGroupSetBits(&global_event, EVENT_CLEAN_FILTER_NOTIFY);
|
|||
|
|
vOxygenEventGroupSetBits(&global_event, EVENT_REPLACE_FILTER_NOTIFY);
|
|||
|
|
|
|||
|
|
// <20><>EEPROM<4F><4D>д<EFBFBD>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
filter_item.data.filter_server.last_clean_filter_hours = ui.disp_info.work_hours;
|
|||
|
|
filter_item.data.filter_server.last_replace_filter_hours = ui.disp_info.work_hours;
|
|||
|
|
filter_item.data.filter_server.clean_filter_time_need_stored = true;
|
|||
|
|
filter_item.data.filter_server.replace_filter_time_need_stored = true;
|
|||
|
|
|
|||
|
|
modify_or_add_queue_node_by_type(&global_queue, MSG_TYPE_FILTER_TIME_SAVE, filter_item);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
if((ui.disp_info.work_hours > filter_item.data.filter_server.last_clean_filter_hours)&&
|
|||
|
|
!xOxygenEventGroupCheckBit(&global_event, EVENT_CLEAN_FILTER_NOTIFY))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
vOxygenEventGroupSetBits(&global_event, EVENT_CLEAN_FILTER_NOTIFY);
|
|||
|
|
|
|||
|
|
// <20><>EEPROM<4F><4D>д<EFBFBD>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
filter_item.data.filter_server.last_clean_filter_hours = ui.disp_info.work_hours;
|
|||
|
|
filter_item.data.filter_server.clean_filter_time_need_stored = true;
|
|||
|
|
filter_item.data.filter_server.replace_filter_time_need_stored = false;
|
|||
|
|
|
|||
|
|
modify_or_add_queue_node_by_type(&global_queue, MSG_TYPE_FILTER_TIME_SAVE, filter_item);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ۼ<EFBFBD>
|
|||
|
|
if(current_seconds < 60)
|
|||
|
|
{
|
|||
|
|
current_seconds++; // <20>ۼ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
|||
|
|
qitem_current_time_modify.type = MSG_TYPE_CURRENT_TIME;
|
|||
|
|
|
|||
|
|
qitem_current_time_modify.data.hour_meter.second = current_seconds;
|
|||
|
|
qitem_current_time_modify.data.hour_meter.minute = current_minutes;
|
|||
|
|
qitem_current_time_modify.data.hour_meter.hour = current_hours;
|
|||
|
|
|
|||
|
|
modify_or_add_queue_node_by_type(&global_queue, MSG_TYPE_CURRENT_TIME, qitem_current_time_modify);
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
current_seconds = 0; // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
if(current_minutes < 60)
|
|||
|
|
{
|
|||
|
|
current_minutes++;
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
current_minutes = 1;
|
|||
|
|
|
|||
|
|
if(current_hours < 4000000000) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ʮ<EFBFBD><CAAE>Сʱ
|
|||
|
|
{
|
|||
|
|
current_hours++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
void led_blink_task(void)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
static uint16_t state_led_blink_count = 0;
|
|||
|
|
|
|||
|
|
const uint16_t BLINK_FREQ_HZ = 2; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸Ƶ<CBB8><C6B5>Ϊ1sһ<73><D2BB> <20><>ѡƵ<D1A1><C6B5>Ϊ1Hz 2Hz 5Hz 10Hz
|
|||
|
|
|
|||
|
|
MsgQueueItem stm_item;
|
|||
|
|
|
|||
|
|
peek_queue_node_by_type(&global_queue, MSG_TYPE_OXG_STM, &stm_item); // ȡ<><C8A1><EFBFBD><EFBFBD>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>ϵͳ״̬<D7B4>ļ<EFBFBD>¼
|
|||
|
|
|
|||
|
|
if(stm_item.data.state_machine.oxg_stm == STM_INIT) // <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>ȷ<EFBFBD><C8B7>LED<45><44>ʾ״̬
|
|||
|
|
{
|
|||
|
|
STATE_LED_ON;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(state_led_blink_count == 10/BLINK_FREQ_HZ)
|
|||
|
|
{
|
|||
|
|
STATE_LED_TOGGLE;
|
|||
|
|
|
|||
|
|
|
|||
|
|
state_led_blink_count = 1;
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
state_led_blink_count++;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/************************ (C) COPYRIGHT FMSH *****END OF FILE****/
|
|||
|
|
|