diff --git a/examples/temp_sensor/rakefile_helper.rb b/examples/temp_sensor/rakefile_helper.rb index fb4a262..99208cd 100644 --- a/examples/temp_sensor/rakefile_helper.rb +++ b/examples/temp_sensor/rakefile_helper.rb @@ -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 diff --git a/examples/temp_sensor/src/TemperatureFilter.c b/examples/temp_sensor/src/TemperatureFilter.c index 02fc045..cd2b4a2 100644 --- a/examples/temp_sensor/src/TemperatureFilter.c +++ b/examples/temp_sensor/src/TemperatureFilter.c @@ -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); } } diff --git a/examples/temp_sensor/gcc.yml b/examples/temp_sensor/targets/gcc.yml similarity index 100% rename from examples/temp_sensor/gcc.yml rename to examples/temp_sensor/targets/gcc.yml diff --git a/examples/temp_sensor/iar_v4.yml b/examples/temp_sensor/targets/iar_v4.yml similarity index 100% rename from examples/temp_sensor/iar_v4.yml rename to examples/temp_sensor/targets/iar_v4.yml diff --git a/examples/temp_sensor/iar_v5.yml b/examples/temp_sensor/targets/iar_v5.yml similarity index 100% rename from examples/temp_sensor/iar_v5.yml rename to examples/temp_sensor/targets/iar_v5.yml diff --git a/examples/temp_sensor/test/TestTimerInterruptConfigurator.c b/examples/temp_sensor/test/TestTimerInterruptConfigurator.c index 13c35f4..9526525 100644 --- a/examples/temp_sensor/test/TestTimerInterruptConfigurator.c +++ b/examples/temp_sensor/test/TestTimerInterruptConfigurator.c @@ -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]); }