Made a bool for error and high temp

This commit is contained in:
Inamr 2024-03-13 13:07:29 +01:00
parent 8e58925dd1
commit 24190f1f15
3 changed files with 257 additions and 246 deletions

View File

@ -7,6 +7,11 @@
<itemPath>eeprom.h</itemPath> <itemPath>eeprom.h</itemPath>
<itemPath>themistor-temp.h</itemPath> <itemPath>themistor-temp.h</itemPath>
</logicalFolder> </logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="true">
<itemPath>Makefile</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript" <logicalFolder name="LinkerScript"
displayName="Linker Files" displayName="Linker Files"
projectFiles="true"> projectFiles="true">
@ -18,11 +23,6 @@
<itemPath>eeprom.c</itemPath> <itemPath>eeprom.c</itemPath>
<itemPath>thermistor-temp.c</itemPath> <itemPath>thermistor-temp.c</itemPath>
</logicalFolder> </logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false">
<itemPath>Makefile</itemPath>
</logicalFolder>
</logicalFolder> </logicalFolder>
<projectmakefile>Makefile</projectmakefile> <projectmakefile>Makefile</projectmakefile>
<confs> <confs>
@ -34,7 +34,7 @@
<targetPluginBoard></targetPluginBoard> <targetPluginBoard></targetPluginBoard>
<platformTool>nEdbgTool</platformTool> <platformTool>nEdbgTool</platformTool>
<languageToolchain>XC8</languageToolchain> <languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.45</languageToolchainVersion> <languageToolchainVersion>2.46</languageToolchainVersion>
<platform>2</platform> <platform>2</platform>
</toolsSet> </toolsSet>
<packs> <packs>

View File

@ -12,6 +12,8 @@
extern "C" { extern "C" {
#endif #endif
#include <stdbool.h>
#include <float.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -26,7 +28,7 @@ extern "C" {
// Returns the thermistor themperature // Returns the thermistor themperature
float calculate_thermistor_temp(float readValue); float calculate_thermistor_temp(float readValue);
bool error_message(float thermistor_temp);

View File

@ -1,6 +1,5 @@
#include "themistor-temp.h" #include "themistor-temp.h"
float calculate_thermistor_temp(float readValue){ float calculate_thermistor_temp(float readValue){
float R_therm; float R_therm;
float V_1; float V_1;
@ -26,3 +25,13 @@ float calculate_thermistor_temp(float readValue){
return T_therm; return T_therm;
} }
bool error_message(float thermistor_temp){
int high_temp = 0;
if (thermistor_temp > high_temp){
return true;
}
else {
return false;
}
}