server production version - gunicorn

This commit is contained in:
2026-09-20 21:07:10 +02:00
parent ceb2431f8e
commit b2d268c5a0
8 changed files with 56 additions and 6 deletions
+2 -1
View File
@@ -22,7 +22,8 @@ void main_loop(void *pvParameters) {
vTaskDelay(pdMS_TO_TICKS(1000));
while (1) {
ygg_bmp280_read_sensor(&dev_bmp_280);
ygg_send_sensor_readouts(SENSOR_NAME,
ygg_send_sensor_readouts(BASE_URL,
SENSOR_NAME,
CURR_READOUT);
vTaskDelay(pdMS_TO_TICKS(10000));
}
+4 -3
View File
@@ -106,13 +106,14 @@ char* ygg_send_post(const char *url, char *post_data) {
int ygg_get_sensor_id(const char *sensor_name,
const char *url);
void ygg_send_sensor_readouts(const char *sensor_name,
void ygg_send_sensor_readouts(const char *base_url,
const char *sensor_name,
ygg_sensor_readout readout) {
char post_data[64];
int sensor_id = ygg_get_sensor_id(sensor_name, "http://192.168.0.236:5000");
int sensor_id = ygg_get_sensor_id(sensor_name, base_url);
char url[128];
snprintf(url, sizeof(url),
"http://192.168.0.236:5000/api/sensors/%d/readouts", sensor_id);
"%s/api/sensors/%d/readouts", base_url, sensor_id);
snprintf(post_data, sizeof(post_data),
"{\"type\":\"temperature\", \"value\":%.2f}", readout.temperature);
+2 -1
View File
@@ -3,7 +3,8 @@
#include "ygg_state.h"
void ygg_send_sensor_readouts(const char *sensor_name,
void ygg_send_sensor_readouts(const char *base_url,
const char *sensor_name,
ygg_sensor_readout readout);
#endif
+1
View File
@@ -9,5 +9,6 @@ typedef struct {
extern ygg_sensor_readout CURR_READOUT;
static const char *SENSOR_NAME = "BMP_280";
static const char *BASE_URL = "http://192.168.0.236:5000";
#endif