From 9f27bc845479104bc45d7cdfc2623cfc8bca9257 Mon Sep 17 00:00:00 2001 From: Elp03 Date: Tue, 16 Apr 2024 15:56:51 +0200 Subject: [PATCH] Fix names --- prosjekt.X/themistor-temp.h | 3 ++- prosjekt.X/thermistor-temp.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/prosjekt.X/themistor-temp.h b/prosjekt.X/themistor-temp.h index 8668c9c..d544435 100644 --- a/prosjekt.X/themistor-temp.h +++ b/prosjekt.X/themistor-temp.h @@ -30,8 +30,9 @@ float calculate_thermistor_temp(float readValue); // Returns true if temperatur is higher than max_temp -bool error_message(float thermistor_temp, uint8_t max_temp); +bool voltage_threshold_bool(float thermistor_temp, uint8_t max_temp); +void voltage_threshold_exceeded(bool voltage_threshold_bool); #ifdef __cplusplus diff --git a/prosjekt.X/thermistor-temp.c b/prosjekt.X/thermistor-temp.c index 4d41ea2..2d333f8 100644 --- a/prosjekt.X/thermistor-temp.c +++ b/prosjekt.X/thermistor-temp.c @@ -1,6 +1,6 @@ #include "themistor-temp.h" -float calculate_thermistor_temp(float readValue){ +float calculate_thermistor_temp(float thermistor_voltage){ float R_therm; float V_1; float ln; @@ -8,7 +8,7 @@ float calculate_thermistor_temp(float readValue){ float V_therm; uint8_t V_tot = 5; // Calculate Voltage over thermistor - V_therm = (V_tot/1024)*readValue; + V_therm = (V_tot/1024)*thermistor_voltage; // Voltage accross R_1 V_1 = V_tot - V_therm; @@ -28,13 +28,19 @@ float calculate_thermistor_temp(float readValue){ // returns error message if the messured thermistor temp is higher than // Choosen max_temp -bool error_message(float thermistor_temp, uint8_t max_temp){ +bool voltage_threshold_bool(float thermistor_temp, uint8_t max_temp){ // Return true if temp is higher then max value if (thermistor_temp >= max_temp){ - printf("Error"); return true; } else { return false; } +} + +//print if the maximum threshold is exceeded. +void voltage_threshold_exceeded(bool voltage_threshold_bool){ + if (voltage_threshold_bool){ + printf("Error: maximum temperature exceeded"); + } } \ No newline at end of file