添加了读保护与定时重启
This commit is contained in:
parent
27c9850517
commit
4f012874be
|
@ -719,18 +719,25 @@ void my_update_mcs_param(float new_wind_speed, float new_wind_dirction)
|
||||||
void tem_hum_update_task(void const * argument)
|
void tem_hum_update_task(void const * argument)
|
||||||
{
|
{
|
||||||
int time_s_temp_humi = 0;
|
int time_s_temp_humi = 0;
|
||||||
|
uint32_t time_s_1Day = 0;
|
||||||
|
|
||||||
get_temp_humi_data(&g_stMcs_Para.temperature, &g_stMcs_Para.humidity);//开机先采集一次
|
get_temp_humi_data(&g_stMcs_Para.temperature, &g_stMcs_Para.humidity);//开机先采集一次
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
osDelay(1000);
|
osDelay(1000);
|
||||||
time_s_temp_humi ++;
|
time_s_temp_humi ++;
|
||||||
|
time_s_1Day ++;
|
||||||
|
|
||||||
if (time_s_temp_humi >= g_stConfigInfo.temp_hum_update_time)
|
if (time_s_temp_humi >= g_stConfigInfo.temp_hum_update_time)
|
||||||
{
|
{
|
||||||
get_temp_humi_data(&g_stMcs_Para.temperature, &g_stMcs_Para.humidity);
|
get_temp_humi_data(&g_stMcs_Para.temperature, &g_stMcs_Para.humidity);
|
||||||
time_s_temp_humi = 0;
|
time_s_temp_humi = 0;
|
||||||
}
|
}
|
||||||
|
if (time_s_1Day >= 86400)
|
||||||
|
{
|
||||||
|
__iar_builtin_set_FAULTMASK(1);
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
|
||||||
my_update_mcs_param(av_speed, av_angle);
|
my_update_mcs_param(av_speed, av_angle);
|
||||||
//采集HP203B数据(大气压)
|
//采集HP203B数据(大气压)
|
||||||
|
|
|
@ -81,6 +81,40 @@ void MX_FREERTOS_Init(void);
|
||||||
|
|
||||||
/* Private user code ---------------------------------------------------------*/
|
/* Private user code ---------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN 0 */
|
||||||
|
void Flash_EnableReadProtection(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
FLASH_OBProgramInitTypeDef OBInit;
|
||||||
|
|
||||||
|
__HAL_FLASH_PREFETCH_BUFFER_DISABLE();
|
||||||
|
|
||||||
|
HAL_FLASHEx_OBGetConfig(&OBInit);
|
||||||
|
|
||||||
|
if(OBInit.RDPLevel == OB_RDP_LEVEL_0)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
OBInit.OptionType |= OPTIONBYTE_RDP;
|
||||||
|
|
||||||
|
OBInit.RDPLevel = OB_RDP_LEVEL_1;
|
||||||
|
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
|
||||||
|
HAL_FLASH_OB_Unlock();
|
||||||
|
|
||||||
|
HAL_FLASHEx_OBProgram(&OBInit);
|
||||||
|
|
||||||
|
HAL_FLASH_OB_Launch();//必须添加这个,不然读保护设置不生效
|
||||||
|
|
||||||
|
HAL_FLASH_OB_Lock();
|
||||||
|
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
|
||||||
|
|
||||||
|
}
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +125,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
|
Flash_EnableReadProtection();//读保护
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
/* MCU Configuration--------------------------------------------------------*/
|
/* MCU Configuration--------------------------------------------------------*/
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,8 +12,8 @@
|
||||||
<ByteLimit>50</ByteLimit>
|
<ByteLimit>50</ByteLimit>
|
||||||
</Stack>
|
</Stack>
|
||||||
<PlDriver>
|
<PlDriver>
|
||||||
<FirstRun>0</FirstRun>
|
|
||||||
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32L496RG.ddf</MemConfigValue>
|
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32L496RG.ddf</MemConfigValue>
|
||||||
|
<FirstRun>0</FirstRun>
|
||||||
</PlDriver>
|
</PlDriver>
|
||||||
<Jet>
|
<Jet>
|
||||||
<JetConnSerialNo>WCH CMSIS-DAP:1BEC8F06A0E4</JetConnSerialNo>
|
<JetConnSerialNo>WCH CMSIS-DAP:1BEC8F06A0E4</JetConnSerialNo>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||||
</ArmDriver>
|
</ArmDriver>
|
||||||
<DebugChecksum>
|
<DebugChecksum>
|
||||||
<Checksum>3954847773</Checksum>
|
<Checksum>667954530</Checksum>
|
||||||
</DebugChecksum>
|
</DebugChecksum>
|
||||||
<Exceptions>
|
<Exceptions>
|
||||||
<StopOnUncaught>_ 0</StopOnUncaught>
|
<StopOnUncaught>_ 0</StopOnUncaught>
|
||||||
|
@ -50,8 +50,8 @@
|
||||||
<PowerConnectPC>1</PowerConnectPC>
|
<PowerConnectPC>1</PowerConnectPC>
|
||||||
</SWOManager>
|
</SWOManager>
|
||||||
<Disassembly>
|
<Disassembly>
|
||||||
<MixedMode>1</MixedMode>
|
|
||||||
<InstrCount>0</InstrCount>
|
<InstrCount>0</InstrCount>
|
||||||
|
<MixedMode>1</MixedMode>
|
||||||
</Disassembly>
|
</Disassembly>
|
||||||
<TerminalIO>
|
<TerminalIO>
|
||||||
<InputSource>1</InputSource>
|
<InputSource>1</InputSource>
|
||||||
|
@ -82,13 +82,31 @@
|
||||||
<NoPCCapture>0</NoPCCapture>
|
<NoPCCapture>0</NoPCCapture>
|
||||||
</ETMTraceWindow>
|
</ETMTraceWindow>
|
||||||
<StLinkDriver>
|
<StLinkDriver>
|
||||||
<stlinkserialNo>0665FF323541483043141633</stlinkserialNo>
|
|
||||||
<stlinkfoundProbes />
|
|
||||||
<stlinkResetStyle>0</stlinkResetStyle>
|
|
||||||
<stlinkResetStrategy>2</stlinkResetStrategy>
|
|
||||||
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
|
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
|
||||||
<CStepIntDis>_ 0</CStepIntDis>
|
<CStepIntDis>_ 0</CStepIntDis>
|
||||||
|
<stlinkResetStyle>0</stlinkResetStyle>
|
||||||
|
<stlinkResetStrategy>2</stlinkResetStrategy>
|
||||||
|
<stlinkserialNo>0665FF323541483043141633</stlinkserialNo>
|
||||||
|
<stlinkfoundProbes />
|
||||||
</StLinkDriver>
|
</StLinkDriver>
|
||||||
|
<SWOTraceHWSettings>
|
||||||
|
<OverrideDefaultClocks>0</OverrideDefaultClocks>
|
||||||
|
<CpuClock>80000000</CpuClock>
|
||||||
|
<ClockAutoDetect>0</ClockAutoDetect>
|
||||||
|
<ClockWanted>2000000</ClockWanted>
|
||||||
|
<JtagSpeed>2000000</JtagSpeed>
|
||||||
|
<Prescaler>40</Prescaler>
|
||||||
|
<TimeStampPrescIndex>0</TimeStampPrescIndex>
|
||||||
|
<TimeStampPrescData>0</TimeStampPrescData>
|
||||||
|
<PcSampCYCTAP>1</PcSampCYCTAP>
|
||||||
|
<PcSampPOSTCNT>15</PcSampPOSTCNT>
|
||||||
|
<PcSampIndex>0</PcSampIndex>
|
||||||
|
<DataLogMode>0</DataLogMode>
|
||||||
|
<ITMportsEnable>0</ITMportsEnable>
|
||||||
|
<ITMportsTermIO>0</ITMportsTermIO>
|
||||||
|
<ITMportsLogFile>0</ITMportsLogFile>
|
||||||
|
<ITMlogFile>$PROJ_DIR$\ITM.log</ITMlogFile>
|
||||||
|
</SWOTraceHWSettings>
|
||||||
<Trace2>
|
<Trace2>
|
||||||
<Enabled>0</Enabled>
|
<Enabled>0</Enabled>
|
||||||
<ShowSource>0</ShowSource>
|
<ShowSource>0</ShowSource>
|
||||||
|
@ -134,35 +152,6 @@
|
||||||
<ShowTimeSum>1</ShowTimeSum>
|
<ShowTimeSum>1</ShowTimeSum>
|
||||||
<SumSortOrder>0</SumSortOrder>
|
<SumSortOrder>0</SumSortOrder>
|
||||||
</EventLog>
|
</EventLog>
|
||||||
<DriverProfiling>
|
|
||||||
<Enabled>0</Enabled>
|
|
||||||
<Mode>3</Mode>
|
|
||||||
<Graph>0</Graph>
|
|
||||||
<Symbiont>0</Symbiont>
|
|
||||||
<Exclusions />
|
|
||||||
</DriverProfiling>
|
|
||||||
<SWOTraceHWSettings>
|
|
||||||
<OverrideDefaultClocks>0</OverrideDefaultClocks>
|
|
||||||
<CpuClock>80000000</CpuClock>
|
|
||||||
<ClockAutoDetect>0</ClockAutoDetect>
|
|
||||||
<ClockWanted>2000000</ClockWanted>
|
|
||||||
<JtagSpeed>2000000</JtagSpeed>
|
|
||||||
<Prescaler>40</Prescaler>
|
|
||||||
<TimeStampPrescIndex>0</TimeStampPrescIndex>
|
|
||||||
<TimeStampPrescData>0</TimeStampPrescData>
|
|
||||||
<PcSampCYCTAP>1</PcSampCYCTAP>
|
|
||||||
<PcSampPOSTCNT>15</PcSampPOSTCNT>
|
|
||||||
<PcSampIndex>0</PcSampIndex>
|
|
||||||
<DataLogMode>0</DataLogMode>
|
|
||||||
<ITMportsEnable>0</ITMportsEnable>
|
|
||||||
<ITMportsTermIO>0</ITMportsTermIO>
|
|
||||||
<ITMportsLogFile>0</ITMportsLogFile>
|
|
||||||
<ITMlogFile>$PROJ_DIR$\ITM.log</ITMlogFile>
|
|
||||||
</SWOTraceHWSettings>
|
|
||||||
<TermIOLog>
|
|
||||||
<LoggingEnabled>_ 0</LoggingEnabled>
|
|
||||||
<LogFile>_ ""</LogFile>
|
|
||||||
</TermIOLog>
|
|
||||||
<DisassembleMode>
|
<DisassembleMode>
|
||||||
<mode>0</mode>
|
<mode>0</mode>
|
||||||
</DisassembleMode>
|
</DisassembleMode>
|
||||||
|
@ -173,4 +162,15 @@
|
||||||
<Count>0</Count>
|
<Count>0</Count>
|
||||||
<SuppressDialog>0</SuppressDialog>
|
<SuppressDialog>0</SuppressDialog>
|
||||||
</Aliases>
|
</Aliases>
|
||||||
|
<DriverProfiling>
|
||||||
|
<Enabled>0</Enabled>
|
||||||
|
<Mode>3</Mode>
|
||||||
|
<Graph>0</Graph>
|
||||||
|
<Symbiont>0</Symbiont>
|
||||||
|
<Exclusions />
|
||||||
|
</DriverProfiling>
|
||||||
|
<TermIOLog>
|
||||||
|
<LoggingEnabled>_ 0</LoggingEnabled>
|
||||||
|
<LogFile>_ ""</LogFile>
|
||||||
|
</TermIOLog>
|
||||||
</settings>
|
</settings>
|
||||||
|
|
Loading…
Reference in New Issue