summaryrefslogtreecommitdiffstats
path: root/src/server/main.c
diff options
context:
space:
mode:
authorGravatar Gediminas Jakutis <gediminas@varciai.lt> 2018-02-11 21:44:54 +0200
committerGravatar Gediminas Jakutis <gediminas@varciai.lt> 2018-02-11 21:44:54 +0200
commit614fa2a57be0979924d21dde461b1437238cfa9f (patch)
treef2aa047a6601f26d9d4f7b7af37ded333622a067 /src/server/main.c
parent599971784bb74045c6ee2762e20fd1d91bf286cd (diff)
downloadcoffeetemp-614fa2a57be0979924d21dde461b1437238cfa9f.tar.gz
coffeetemp-614fa2a57be0979924d21dde461b1437238cfa9f.tar.bz2
coffeetemp-614fa2a57be0979924d21dde461b1437238cfa9f.zip
remove useless MPU-6050 temp reading support.
Diffstat (limited to 'src/server/main.c')
-rw-r--r--src/server/main.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/src/server/main.c b/src/server/main.c
index 737d694..11581ae 100644
--- a/src/server/main.c
+++ b/src/server/main.c
@@ -36,8 +36,7 @@ static void init(const unsigned int port, int *sock);
static int getpacket(char *data, size_t buffsize, int *sock, struct sockaddr_in *sender);
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_temp(const short int rawdata);
+static float digest_temp(const short int rawdata);
int main(void)
{
@@ -136,59 +135,40 @@ static void draw_idle(void)
printw("sequence: [waiting for ESP8266...]");
move(1, 0);
clrtoeol();
- mvprintw(1, 0, "mpu temp: [waiting for ESP8266...]");
+ mvprintw(1, 0, "thermistor temp: [waiting for ESP8266...]");
move(2, 0);
clrtoeol();
- mvprintw(2, 0, "thermistor temp: [waiting for ESP8266...]");
- move(3, 0);
- clrtoeol();
- mvprintw(3, 0, "press 'q' to exit");
+ mvprintw(2, 0, "press 'q' to exit");
refresh();
}
static void draw_busy(const char * const data)
{
unsigned int sequence;
- short int mpu_data;
short int thermistor_data;
- float mpu_temp;
- float thermistor_temp;
+ float 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_temp = digest_thermistor_temp(thermistor_data);
+ memcpy(&thermistor_data, data + 6, sizeof(thermistor_data));
+ temp = digest_temp(thermistor_data);
move(0, 0);
clrtoeol();
printw("sequence: %u", sequence);
move(1, 0);
clrtoeol();
- mvprintw(1, 0, "mpu temp: %.3fC", mpu_temp);
+ mvprintw(1, 0, "thermistor temp: %.1fC", temp);
move(2, 0);
clrtoeol();
- mvprintw(2, 0, "thermistor temp: %.1fC", thermistor_temp);
- move(3, 0);
- clrtoeol();
- mvprintw(3, 0, "press 'q' to exit");
+ mvprintw(2, 0, "press 'q' to exit");
refresh();
}
-static float digest_mpu_temp(const short int rawdata)
-{
- float ret;
-
- ret = rawdata / 340.0f + 36.53f;
-
- return ret;
-}
-
/*
* 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)
+static float digest_temp(const short int rawdata)
{
float ret;