summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/main.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/server/main.c b/src/server/main.c
index 08e85b7..737d694 100644
--- a/src/server/main.c
+++ b/src/server/main.c
@@ -37,7 +37,7 @@ static int getpacket(char *data, size_t buffsize, int *sock, struct sockaddr_in
static void draw_idle(void);
static void draw_busy(const char * const data);
static float digest_mpu_temp(const short int rawdata);
-static float digest_thermistor_voltage(const short int rawdata);
+static float digest_thermistor_temp(const short int rawdata);
int main(void)
{
@@ -139,7 +139,7 @@ static void draw_idle(void)
mvprintw(1, 0, "mpu temp: [waiting for ESP8266...]");
move(2, 0);
clrtoeol();
- mvprintw(2, 0, "thermistor voltage: [waiting for ESP8266...]");
+ mvprintw(2, 0, "thermistor temp: [waiting for ESP8266...]");
move(3, 0);
clrtoeol();
mvprintw(3, 0, "press 'q' to exit");
@@ -152,13 +152,13 @@ static void draw_busy(const char * const data)
short int mpu_data;
short int thermistor_data;
float mpu_temp;
- float thermistor_voltage;
+ float thermistor_temp;
memcpy(&sequence, data + 2, sizeof(sequence));
memcpy(&mpu_data, data + 6, sizeof(mpu_data));
memcpy(&thermistor_data, data + 8, sizeof(thermistor_data));
mpu_temp = digest_mpu_temp(mpu_data);
- thermistor_voltage = digest_thermistor_voltage(thermistor_data);
+ thermistor_temp = digest_thermistor_temp(thermistor_data);
move(0, 0);
clrtoeol();
@@ -168,7 +168,7 @@ static void draw_busy(const char * const data)
mvprintw(1, 0, "mpu temp: %.3fC", mpu_temp);
move(2, 0);
clrtoeol();
- mvprintw(2, 0, "thermistor voltage: %.3fV", thermistor_voltage);
+ mvprintw(2, 0, "thermistor temp: %.1fC", thermistor_temp);
move(3, 0);
clrtoeol();
mvprintw(3, 0, "press 'q' to exit");
@@ -184,11 +184,15 @@ static float digest_mpu_temp(const short int rawdata)
return ret;
}
-static float digest_thermistor_voltage(const short int rawdata)
+/*
+ * raw data is in 0.1°K per 1. Subtract 2730 to get Celsius.
+ * Multiply by 0.1f (divide by 10) to get the correct scale.
+ */
+static float digest_thermistor_temp(const short int rawdata)
{
float ret;
- ret = rawdata * 0.003222656f;
+ ret = (rawdata - 2730) * 0.1f;
return ret;
}