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

View File

@ -27,8 +27,10 @@ extern "C" {
// Calculates the temperature in celcius
// Returns the thermistor themperature
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;
}
// returns error message
bool error_message(float thermistor_temp){
// Max value
int high_temp = 0;
// returns error message if the messured thermistor temp is higher than
// Choosen max_temp
bool error_message(float thermistor_temp, uint8_t max_temp){
// Return true if temp is higher then max value
if (thermistor_temp > high_temp){
if (thermistor_temp >= max_temp){
printf("Error");
return true;
}