Change error temp

Make it able to innputt a chosen max temp
This commit is contained in:
Elp03 2024-03-20 11:06:46 +01:00
parent 4a66e1dcdc
commit 849c719b59
3 changed files with 188 additions and 187 deletions

View File

@ -4,8 +4,8 @@
<logicalFolder name="HeaderFiles" <logicalFolder name="HeaderFiles"
displayName="Header Files" displayName="Header Files"
projectFiles="true"> projectFiles="true">
<itemPath>eeprom.h</itemPath>
<itemPath>themistor-temp.h</itemPath> <itemPath>themistor-temp.h</itemPath>
<itemPath>uart.h</itemPath>
</logicalFolder> </logicalFolder>
<logicalFolder name="ExternalFiles" <logicalFolder name="ExternalFiles"
displayName="Important Files" displayName="Important Files"
@ -20,8 +20,8 @@
displayName="Source Files" displayName="Source Files"
projectFiles="true"> projectFiles="true">
<itemPath>main.c</itemPath> <itemPath>main.c</itemPath>
<itemPath>eeprom.c</itemPath>
<itemPath>thermistor-temp.c</itemPath> <itemPath>thermistor-temp.c</itemPath>
<itemPath>uart.c</itemPath>
</logicalFolder> </logicalFolder>
</logicalFolder> </logicalFolder>
<projectmakefile>Makefile</projectmakefile> <projectmakefile>Makefile</projectmakefile>
@ -34,7 +34,7 @@
<targetPluginBoard></targetPluginBoard> <targetPluginBoard></targetPluginBoard>
<platformTool>nEdbgTool</platformTool> <platformTool>nEdbgTool</platformTool>
<languageToolchain>XC8</languageToolchain> <languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.46</languageToolchainVersion> <languageToolchainVersion>2.45</languageToolchainVersion>
<platform>2</platform> <platform>2</platform>
</toolsSet> </toolsSet>
<packs> <packs>

View File

@ -27,8 +27,10 @@ extern "C" {
// Calculates the temperature in celcius // Calculates the temperature in celcius
// Returns the thermistor themperature // Returns the thermistor themperature
float calculate_thermistor_temp(float readValue); float calculate_thermistor_temp(float readValue);
// Returns true if temperatur is higher then high_temp int
bool error_message(float thermistor_temp);
// Returns true if temperatur is higher than max_temp
bool error_message(float thermistor_temp, uint8_t max_temp);

View File

@ -26,12 +26,11 @@ float calculate_thermistor_temp(float readValue){
return T_therm; return T_therm;
} }
// returns error message // returns error message if the messured thermistor temp is higher than
bool error_message(float thermistor_temp){ // Choosen max_temp
// Max value bool error_message(float thermistor_temp, uint8_t max_temp){
int high_temp = 0;
// Return true if temp is higher then max value // Return true if temp is higher then max value
if (thermistor_temp > high_temp){ if (thermistor_temp >= max_temp){
printf("Error"); printf("Error");
return true; return true;
} }