Merge termistor into main #14

Closed
Athamantis wants to merge 0 commits from thermistor-temp into main
Owner
No description provided.
Athamantis self-assigned this 2024-03-20 10:10:51 +00:00
Inamr was assigned by Athamantis 2024-03-20 10:10:51 +00:00
sebgab was assigned by Athamantis 2024-03-20 10:10:51 +00:00
Athamantis added 6 commits 2024-03-20 10:10:51 +00:00
sebgab requested changes 2024-04-09 10:45:09 +00:00
sebgab left a comment
Owner

Minor changes requested.

Minor changes requested.
@ -0,0 +26,4 @@
// Takes inn messured value
// Calculates the temperature in celcius
// Returns the thermistor themperature
float calculate_thermistor_temp(float readValue);
Owner

variable readValue needs better name, e.g. thermistorVoltage or something along those lines as readValue is not indicative of the actual value being input into the function.

variable `readValue` needs better name, e.g. `thermistorVoltage` or something along those lines as `readValue` is not indicative of the actual value being input into the function.
Author
Owner

fixed in 9f27bc8454

fixed in 9f27bc845479104bc45d7cdfc2623cfc8bca9257
Athamantis marked this conversation as resolved
@ -0,0 +30,4 @@
// Returns true if temperatur is higher than max_temp
bool error_message(float thermistor_temp, uint8_t max_temp);
Owner

This does not return an error message, it returns a bool.
Rename the function to something along the lines of voltage_threshold_exceeded or similar as this is what the function actually does.

This does not return an error message, it returns a bool. Rename the function to something along the lines of `voltage_threshold_exceeded` or similar as this is what the function actually does.
Author
Owner

fixed in 9f27bc8454

fixed in 9f27bc845479104bc45d7cdfc2623cfc8bca9257
Owner

If this is the check function this should likely be called something along those lines to make It very clear what it does.

If this is the check function this should likely be called something along those lines to make It very clear what it does.
Author
Owner
933949dcffc1e9a22bc49abcf3b0af52f5bb4b7c fix
Athamantis marked this conversation as resolved
@ -0,0 +31,4 @@
bool error_message(float thermistor_temp, uint8_t max_temp){
// Return true if temp is higher then max value
if (thermistor_temp >= max_temp){
printf("Error");
Owner

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.

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.
Author
Owner

fixed in 9f27bc8454

fixed in 9f27bc845479104bc45d7cdfc2623cfc8bca9257
Athamantis marked this conversation as resolved
sebgab changed title from close #3 and #6 to Merge termistor into main 2024-04-09 10:45:25 +00:00
Athamantis added 1 commit 2024-04-16 13:56:57 +00:00
Athamantis requested review from sebgab 2024-04-16 13:57:54 +00:00
sebgab requested changes 2024-04-16 14:27:33 +00:00
@ -0,0 +18,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#define R_t0 10000
Owner

Constants should be capitalized.

Constants should be capitalized.
Author
Owner
933949dcffc1e9a22bc49abcf3b0af52f5bb4b7c fic
Athamantis marked this conversation as resolved
@ -0,0 +32,4 @@
// Returns true if temperatur is higher than max_temp
bool voltage_threshold_bool(float thermistor_temp, uint8_t max_temp);
void voltage_threshold_exceeded(bool voltage_threshold_bool);
Owner

From the name this seems like it is intended to check if it is exceeded. This should likely be named some sort of warn.

From the name this seems like it is intended to check if it is exceeded. This should likely be named some sort of warn.
Author
Owner
fix 933949dcffc1e9a22bc49abcf3b0af52f5bb4b7c
Athamantis marked this conversation as resolved
@ -0,0 +6,4 @@
float ln;
float T_therm;
float V_therm;
uint8_t V_tot = 5;
Owner

This should be a constant.

This should be a constant.
Author
Owner
fix 933949dcffc1e9a22bc49abcf3b0af52f5bb4b7c
Athamantis marked this conversation as resolved
@ -0,0 +14,4 @@
V_1 = V_tot - V_therm;
// Calculate Thermistor resistanse
R_therm = (V_therm)/ (V_1 / R_1);
Owner

Could we remove the shorthands? e.g. "therm" -> "thermistor".

Could we remove the shorthands? e.g. "therm" -> "thermistor".
Author
Owner
fix 933949dcffc1e9a22bc49abcf3b0af52f5bb4b7c
Athamantis marked this conversation as resolved
@ -0,0 +20,4 @@
ln = log(R_therm/R_t0);
T_therm = (1/ ((ln/B) + (1/T_0)));
// Temperatur in celcius
Owner

Temperature is spelled wrong.

Temperature is spelled wrong.
Athamantis marked this conversation as resolved
@ -0,0 +30,4 @@
// Choosen 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){
Owner

This can be shortened to return (thermistor_temp >= max_temp).

This can be shortened to `return (thermistor_temp >= max_temp)`.
Author
Owner
fix 933949dcffc1e9a22bc49abcf3b0af52f5bb4b7c
Athamantis marked this conversation as resolved
@ -0,0 +39,4 @@
}
//print if the maximum threshold is exceeded.
void voltage_threshold_exceeded(bool voltage_threshold_bool){
Owner

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.

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.
Author
Owner
fix 933949dcffc1e9a22bc49abcf3b0af52f5bb4b7c
Athamantis marked this conversation as resolved
Athamantis added 1 commit 2024-04-16 15:25:06 +00:00
Athamantis requested review from sebgab 2024-04-16 15:27:35 +00:00
sebgab approved these changes 2024-04-16 15:56:44 +00:00
sebgab left a comment
Owner

LGTM

LGTM
Owner

Closes #6

Closes #6
Owner

Closes #3

Closes #3
Owner

Closed by e6a3815dc2

Closed by e6a3815dc2c8cb7f7e73b4efea9c16760a3a8cbe
sebgab closed this pull request 2024-04-17 10:03:25 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Mikrokontrollersystemer-gruppe-4/mikrokontrollersystemer-prosjekt#14
No description provided.