Merge termistor into main #14
No reviewers
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Mikrokontrollersystemer-gruppe-4/mikrokontrollersystemer-prosjekt#14
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "thermistor-temp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Minor changes requested.
@ -0,0 +26,4 @@// Takes inn messured value// Calculates the temperature in celcius// Returns the thermistor themperaturefloat calculate_thermistor_temp(float readValue);variable
readValueneeds better name, e.g.thermistorVoltageor something along those lines asreadValueis not indicative of the actual value being input into the function.fixed in
9f27bc8454@ -0,0 +30,4 @@// Returns true if temperatur is higher than max_tempbool error_message(float thermistor_temp, uint8_t max_temp);This does not return an error message, it returns a bool.
Rename the function to something along the lines of
voltage_threshold_exceededor similar as this is what the function actually does.fixed in
9f27bc8454If this is the check function this should likely be called something along those lines to make It very clear what it does.
933949dcfffix@ -0,0 +31,4 @@bool error_message(float thermistor_temp, uint8_t max_temp){// Return true if temp is higher then max valueif (thermistor_temp >= max_temp){printf("Error");The message should be more verbose.
e.g. "Error: maximum temperature exceeded"
This should also likely not be handled by the function is it simply checks for the error.
If the intent of the function is to check and alert for any errors the function should be renamed appropriately.
I believe the task also called for activating a GPIO pin upon alerting, this should then also be done.
fixed in
9f27bc8454close #3 and #6to Merge termistor into main@ -0,0 +18,4 @@#include <stdlib.h>#include <stdint.h>#include <math.h>#define R_t0 10000Constants should be capitalized.
933949dcfffic@ -0,0 +32,4 @@// Returns true if temperatur is higher than max_tempbool voltage_threshold_bool(float thermistor_temp, uint8_t max_temp);void voltage_threshold_exceeded(bool voltage_threshold_bool);From the name this seems like it is intended to check if it is exceeded. This should likely be named some sort of warn.
fix
933949dcff@ -0,0 +6,4 @@float ln;float T_therm;float V_therm;uint8_t V_tot = 5;This should be a constant.
fix
933949dcff@ -0,0 +14,4 @@V_1 = V_tot - V_therm;// Calculate Thermistor resistanseR_therm = (V_therm)/ (V_1 / R_1);Could we remove the shorthands? e.g. "therm" -> "thermistor".
fix
933949dcff@ -0,0 +20,4 @@ln = log(R_therm/R_t0);T_therm = (1/ ((ln/B) + (1/T_0)));// Temperatur in celciusTemperature is spelled wrong.
@ -0,0 +30,4 @@// Choosen max_tempbool voltage_threshold_bool(float thermistor_temp, uint8_t max_temp){// Return true if temp is higher then max valueif (thermistor_temp >= max_temp){This can be shortened to
return (thermistor_temp >= max_temp).fix
933949dcff@ -0,0 +39,4 @@}//print if the maximum threshold is exceeded.void voltage_threshold_exceeded(bool voltage_threshold_bool){This function should also activate some GPIO pins if I remember correctly.
This also means the GPIO pin should be disabled if the alert is not triggered.
fix
933949dcffLGTM
Closes #6
Closes #3
Closed by
e6a3815dc2Pull request closed