Fixes to the temp_sensor example.

This commit is contained in:
Mark VanderVoord
2023-11-22 15:52:54 -05:00
parent 097b3ec42a
commit 32049399b3
6 changed files with 12 additions and 9 deletions
+3 -3
View File
@@ -199,7 +199,7 @@ module RakefileHelpers
next unless header =~ /Mock/
require '../../lib/cmock.rb'
@cmock ||= CMock.new($cfg_file)
@cmock ||= CMock.new('./targets/' + $cfg_file)
@cmock.setup_mocks([$cfg['compiler']['source_path'] + header.gsub('Mock', '')])
end
@@ -217,7 +217,7 @@ module RakefileHelpers
runner_name = test_base + '_Runner.c'
if $cfg['compiler']['runner_path'].nil?
runner_path = $cfg['compiler']['build_path'] + runner_name
test_gen = UnityTestRunnerGenerator.new($cfg_file)
test_gen = UnityTestRunnerGenerator.new('./targets/' + $cfg_file)
test_gen.run(test, runner_path)
else
runner_path = $cfg['compiler']['runner_path'] + runner_name
@@ -254,7 +254,7 @@ module RakefileHelpers
report 'Building application...'
obj_list = []
load_configuration($cfg_file)
load_configuration('./targets/' + $cfg_file)
main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION
# Detect dependencies and build required required modules
+8 -5
View File
@@ -27,13 +27,16 @@ void TemperatureFilter_ProcessInput(float temperature)
{
if (temperature == +INFINITY ||
temperature == -INFINITY ||
temperature == +NAN ||
temperature == -NAN)
temperature != temperature)
{
/* Check if +/- Infinity or NaN... reset to -Inf in this instance. */
initialized = FALSE;
temperature = -INFINITY;
temperatureInCelcius = -INFINITY;
}
else
{
/* Otherwise apply our low-pass filter to smooth the values */
temperatureInCelcius = (temperatureInCelcius * 0.75f) + (temperature * 0.25);
}
temperatureInCelcius = (temperatureInCelcius * 0.75f) + (temperature * 0.25);
}
}
@@ -35,7 +35,7 @@ void testResetSystemTimeDelegatesTo_Timer_SetSystemTime_Appropriately(void)
void testConfigureInterruptShouldSetInterruptHandlerAppropriately(void)
{
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)NULL;
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)0;
Timer_ConfigureInterrupt();
TEST_ASSERT_EQUAL((uint32)Timer_InterruptHandler, AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0]);
}