working on Audio recording braking for hrs

This commit is contained in:
unknown 2025-04-11 10:15:46 +05:30
parent 4ffb4d7cb4
commit 937b19d131
15 changed files with 247394 additions and 9 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -70,6 +70,9 @@
#define eMMC_FLASH 1
#define NOR_FLASH 0
uint8_t RECORDING_BREAK_HOURS = 0;
uint8_t RECORDING_BREAK_MINUTES = 1;
uint8_t fatfs_Mount_Address = NOR_FLASH;
LogLevel_t app_log_level = LOG_INFO; /* LOG_INFO/LOG_DEBUG */
@ -83,6 +86,19 @@ RTC_DateTypeDef cur_date = {0};
uint8_t record_key_press_evt = 0;
uint8_t record_started=0;
char FileName[100];
typedef struct
{
uint8_t Brkot_Hours;
uint8_t Brkot_Minutes;
} Recording_Breakout_TimeTypeDef;
Recording_Breakout_TimeTypeDef Brkot_time;
/*****************************************************************************/
/* */
/* F U N C T I O N P R O T O T Y P E S */
@ -96,7 +112,9 @@ void App_OSTask(void const * argument);
void App_KeyCallbckFnc(uint8_t key_indx,uint8_t key_event,uint16_t key_duration);
void App_AudioRecCallbackFnc(App_AudioRec_State_t state);
void get_audio_file_name(char *file_name);
void get_audio_file_name(char *file_name, uint8_t rec_break_hr, uint8_t rec_break_min);
void Recording_breakout();
/*****************************************************************************/
/* */
/* F U N C T I O N S */
@ -214,16 +232,17 @@ void App_OSTask(void const * argument)
/*****************************************************************************/
void App_Task(uint16_t call_rate)
{
char FileName[100];
// char FileName[100];
App_AudioRec_State_t rec_state;
rec_state = App_AudioRec_GetState();
if(record_key_press_evt)
{
record_key_press_evt = 0;
LOG(LOG_INFO,"Recorder key press event !!! ");
rec_state = App_AudioRec_GetState();
// rec_state = App_AudioRec_GetState();
if(( rec_state== AUDIO_REC_STATE_IDLE)||(rec_state == AUDIO_REC_STATE_STOPPED))
{
get_audio_file_name(FileName);
get_audio_file_name(FileName, RECORDING_BREAK_HOURS, RECORDING_BREAK_MINUTES);
MX_USB_DEVICE_DeInit();
if(App_AudioRec_Start(FileName) != 0)
{
@ -245,9 +264,14 @@ void App_Task(uint16_t call_rate)
else
{
LOG(LOG_INFO,"App_AudioRec_Stop !!!");
Brkot_time.Brkot_Hours = 0;
Brkot_time.Brkot_Minutes = 0;
}
}
}
if(rec_state == AUDIO_REC_STATE_RECORDING){
Recording_breakout();
}
/* Health Led Blinking */
App_HealthLed(call_rate);
// App_HWTest(call_rate);
@ -293,7 +317,7 @@ void App_HealthLed(uint16_t call_rate)
/*****************************************************************************/
/* See header file of description */
/*****************************************************************************/
void get_audio_file_name(char *file_name)
void get_audio_file_name(char *file_name, uint8_t rec_break_hr, uint8_t rec_break_min)
{
HAL_RTC_GetTime(RTC_HDL, &cur_time, RTC_FORMAT_BIN);
HAL_RTC_GetDate(RTC_HDL, &cur_date, RTC_FORMAT_BIN);
@ -301,6 +325,23 @@ void get_audio_file_name(char *file_name)
cur_date.Year,cur_date.Month,cur_date.Date,
cur_time.Hours,cur_time.Minutes,cur_time.Seconds );
uint8_t target_minutes = cur_time.Minutes + rec_break_min;
uint8_t target_hours = cur_time.Hours + rec_break_hr;
if (target_minutes >= 60)
{
target_minutes -= 60;
target_hours += 1;
}
if (target_hours >= 24)
{
target_hours -= 24;
}
Brkot_time.Brkot_Hours = target_hours;
Brkot_time.Brkot_Minutes = target_minutes;
LOG(LOG_INFO,"File: %s",file_name);
}
@ -328,6 +369,32 @@ time_t getUnixTimeStamp()
return currentTime;
}
void Recording_breakout(){
HAL_RTC_GetTime(RTC_HDL, &cur_time, RTC_FORMAT_BIN);
if(cur_time.Hours == Brkot_time.Brkot_Hours && cur_time.Minutes == Brkot_time.Brkot_Minutes)
{
if (App_AudioRec_Stop() != 0) {
LOG(LOG_ERROR, "Recording_breakout_App_AudioRec_Stop Error!!!");
} else {
LOG(LOG_INFO, "Recording_breakout_App_AudioRec_Stop !!!");
Brkot_time.Brkot_Hours = 0;
Brkot_time.Brkot_Minutes = 0;
get_audio_file_name(FileName, RECORDING_BREAK_HOURS, RECORDING_BREAK_MINUTES);
if (App_AudioRec_Start(FileName) != 0) {
LOG(LOG_ERROR, "Recording_breakout_App_AudioRec_Start Error!!!");
MX_USB_DEVICE_Init();
} else {
record_started = 1;
LOG(LOG_INFO, "Recording_breakout_App_AudioRec_Started !!!");
}
}
}
}
/*****************************************************************************/
/* See header file of description */
/*****************************************************************************/

View File

@ -229,9 +229,9 @@ static void lwjson_parse_cb_func(lwjson_stream_parser_t* jsp, lwjson_stream_type
LOG(LOG_INFO,"Got '"JSON_STR_TIMESTAMP"' value: %d ", num);
// num +=19800; //5.30 hr ist
//
// LOG(LOG_INFO,"Got after 5.30 hr adding '"JSON_STR_TIMESTAMP"' value: %d ", num);
num +=19800; //5.30 hr ist
LOG(LOG_INFO,"Got after 5.30 hr adding '"JSON_STR_TIMESTAMP"' value: %d ", num);
App_SetRTC(num);
}

View File

@ -31,7 +31,7 @@
MAJOR_VERSION "." MINOR_VERSION "." BUG_FIX_VERSION "." BUILD_VERSION
*/
#define APP_SW_VER_STR "00.00.00.0845"
#define APP_SW_VER_STR "00.00.00.0859"
/*****************************************************************************/
/* E N D O F F I L E */