修复温度传感器大于80度触发断言卡死整个程序的问题

This commit is contained in:
95384 2024-11-02 10:15:01 +08:00
parent 4f012874be
commit 68293fe710
7 changed files with 123 additions and 85 deletions

View File

@ -142,8 +142,33 @@ BOOL get_temp_humi_data(float* temdata, float* humidata)
tmp_temdata = filter_middle(collect_temdata,COLLECT_DATA_NUM, FILTER_DATA_TYPE_FLOAT); tmp_temdata = filter_middle(collect_temdata,COLLECT_DATA_NUM, FILTER_DATA_TYPE_FLOAT);
tmp_humidata = filter_middle(collect_humidata,COLLECT_DATA_NUM, FILTER_DATA_TYPE_FLOAT); tmp_humidata = filter_middle(collect_humidata,COLLECT_DATA_NUM, FILTER_DATA_TYPE_FLOAT);
AssertError((tmp_temdata.fValue >= -40) && (tmp_temdata.fValue <= 85), return FALSE, "sht30ζÈֵУÑéʧ°Ü"); // 断言有问题
AssertError((tmp_humidata.fValue >= 0) && (tmp_humidata.fValue <= 100), return FALSE, "sht30ʪ¶ÈֵУÑéʧ°Ü"); // AssertError((tmp_temdata.fValue >= -40) && (tmp_temdata.fValue <= 85), return FALSE, "sht30温度值校验失败");
// AssertError((tmp_humidata.fValue >= 0) && (tmp_humidata.fValue <= 100), return FALSE, "sht30湿度值校验失败");
if(tmp_temdata.fValue < -40)
{
tmp_temdata.fValue = -40;
// term_printf("sht30温度值校验失败");
return FALSE;
}
if(tmp_temdata.fValue > 125)
{
tmp_temdata.fValue = 125;
// term_printf("sht30温度值校验失败");
return FALSE;
}
if(tmp_humidata.fValue < 0)
{
tmp_humidata.fValue = 0;
// term_printf("sht30湿度值校验失败");
return FALSE;
}
if(tmp_humidata.fValue > 100)
{
tmp_humidata.fValue = 100;
// term_printf("sht3湿度值校验失败");
return FALSE;
}
*temdata = tmp_temdata.fValue; *temdata = tmp_temdata.fValue;
*humidata = tmp_humidata.fValue; *humidata = tmp_humidata.fValue;

View File

@ -84,7 +84,7 @@
</option> </option>
<option> <option>
<name>OCDynDriverList</name> <name>OCDynDriverList</name>
<state>STLINK_ID</state> <state>CMSISDAP_ID</state>
</option> </option>
<option> <option>
<name>OCLastSavedByProductVersion</name> <name>OCLastSavedByProductVersion</name>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,8 +12,8 @@
<ByteLimit>50</ByteLimit> <ByteLimit>50</ByteLimit>
</Stack> </Stack>
<PlDriver> <PlDriver>
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32L496RG.ddf</MemConfigValue>
<FirstRun>0</FirstRun> <FirstRun>0</FirstRun>
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32L496RG.ddf</MemConfigValue>
</PlDriver> </PlDriver>
<Jet> <Jet>
<JetConnSerialNo>WCH CMSIS-DAP:1BEC8F06A0E4</JetConnSerialNo> <JetConnSerialNo>WCH CMSIS-DAP:1BEC8F06A0E4</JetConnSerialNo>
@ -26,11 +26,11 @@
<CpuHaltOnBreakpointSet>0</CpuHaltOnBreakpointSet> <CpuHaltOnBreakpointSet>0</CpuHaltOnBreakpointSet>
</Jet> </Jet>
<ArmDriver> <ArmDriver>
<EnableCache>0</EnableCache>
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration> <EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
<EnableCache>0</EnableCache>
</ArmDriver> </ArmDriver>
<DebugChecksum> <DebugChecksum>
<Checksum>667954530</Checksum> <Checksum>1421465675</Checksum>
</DebugChecksum> </DebugChecksum>
<Exceptions> <Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught> <StopOnUncaught>_ 0</StopOnUncaught>
@ -65,29 +65,13 @@
<CallStack> <CallStack>
<ShowArgs>0</ShowArgs> <ShowArgs>0</ShowArgs>
</CallStack> </CallStack>
<Trace1>
<Enabled>0</Enabled>
<ShowSource>1</ShowSource>
</Trace1>
<ETMTraceWindow>
<PortWidth>4</PortWidth>
<PortMode>0</PortMode>
<CaptureDataValues>0</CaptureDataValues>
<CaptureDataAddresses>0</CaptureDataAddresses>
<CaptureDataRange>0</CaptureDataRange>
<DataFirst>0</DataFirst>
<DataLast>4294967295</DataLast>
<StopWhen>0</StopWhen>
<StallCPU>0</StallCPU>
<NoPCCapture>0</NoPCCapture>
</ETMTraceWindow>
<StLinkDriver> <StLinkDriver>
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<CStepIntDis>_ 0</CStepIntDis>
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
<stlinkserialNo>0665FF323541483043141633</stlinkserialNo> <stlinkserialNo>0665FF323541483043141633</stlinkserialNo>
<stlinkfoundProbes /> <stlinkfoundProbes />
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<CStepIntDis>_ 0</CStepIntDis>
</StLinkDriver> </StLinkDriver>
<SWOTraceHWSettings> <SWOTraceHWSettings>
<OverrideDefaultClocks>0</OverrideDefaultClocks> <OverrideDefaultClocks>0</OverrideDefaultClocks>
@ -107,20 +91,6 @@
<ITMportsLogFile>0</ITMportsLogFile> <ITMportsLogFile>0</ITMportsLogFile>
<ITMlogFile>$PROJ_DIR$\ITM.log</ITMlogFile> <ITMlogFile>$PROJ_DIR$\ITM.log</ITMlogFile>
</SWOTraceHWSettings> </SWOTraceHWSettings>
<Trace2>
<Enabled>0</Enabled>
<ShowSource>0</ShowSource>
</Trace2>
<SWOTraceWindow>
<PcSampling>0</PcSampling>
<InterruptLogs>0</InterruptLogs>
<ForcedTimeStamps>0</ForcedTimeStamps>
<EventCPI>0</EventCPI>
<EventEXC>0</EventEXC>
<EventFOLD>0</EventFOLD>
<EventLSU>0</EventLSU>
<EventSLEEP>0</EventSLEEP>
</SWOTraceWindow>
<DataLog> <DataLog>
<GraphEnabled>0</GraphEnabled> <GraphEnabled>0</GraphEnabled>
<LogEnabled>0</LogEnabled> <LogEnabled>0</LogEnabled>
@ -152,6 +122,47 @@
<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>
<Trace1>
<Enabled>0</Enabled>
<ShowSource>1</ShowSource>
</Trace1>
<ETMTraceWindow>
<PortWidth>4</PortWidth>
<PortMode>0</PortMode>
<CaptureDataValues>0</CaptureDataValues>
<CaptureDataAddresses>0</CaptureDataAddresses>
<CaptureDataRange>0</CaptureDataRange>
<DataFirst>0</DataFirst>
<DataLast>4294967295</DataLast>
<StopWhen>0</StopWhen>
<StallCPU>0</StallCPU>
<NoPCCapture>0</NoPCCapture>
</ETMTraceWindow>
<Trace2>
<Enabled>0</Enabled>
<ShowSource>0</ShowSource>
</Trace2>
<SWOTraceWindow>
<ForcedPcSampling>0</ForcedPcSampling>
<ForcedInterruptLogs>0</ForcedInterruptLogs>
<ForcedItmLogs>0</ForcedItmLogs>
<EventCPI>0</EventCPI>
<EventEXC>0</EventEXC>
<EventFOLD>0</EventFOLD>
<EventLSU>0</EventLSU>
<EventSLEEP>0</EventSLEEP>
</SWOTraceWindow>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<DisassembleMode> <DisassembleMode>
<mode>0</mode> <mode>0</mode>
</DisassembleMode> </DisassembleMode>
@ -162,15 +173,4 @@
<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>

View File

@ -14,18 +14,30 @@
"--device=STM32L496RG" "--device=STM32L496RG"
"--multicore_nr_of_cores=1"
"--jet_probe=cmsisdap"
"--jet_standard_reset=9,0,0"
"--reset_style=\"0,-,0,Disabled__no_reset_\""
"--reset_style=\"1,-,0,Software\""
"--reset_style=\"2,-,0,Hardware\""
"--reset_style=\"3,-,0,Core\""
"--reset_style=\"4,-,0,System\""
"--reset_style=\"9,ConnectUnderReset,1,Connect_during_reset\""
"--drv_interface=SWD" "--drv_interface=SWD"
"--stlink_reset_strategy=0,2" "--drv_interface_speed=100"
"--drv_swo_clock_setup=80000000,0,2000000"
"--drv_catch_exceptions=0x000" "--drv_catch_exceptions=0x000"
"--drv_debug_ap=0"
"--stlink_probe=stlinkv2"

View File

@ -1,6 +1,6 @@
"D:\Program Files\IAR Systems\arm\bin\armPROC.dll" "D:\Program Files\IAR Systems\arm\bin\armPROC.dll"
"D:\Program Files\IAR Systems\arm\bin\armSTLINK.dll" "D:\Program Files\IAR Systems\arm\bin\armJET.dll"
"E:\Y\IAR\micro_climate\EWARM\micro_climate\Exe\micro_climate.out" "E:\Y\IAR\micro_climate\EWARM\micro_climate\Exe\micro_climate.out"