Commit 1449efd4 authored by Patrick's avatar Patrick

15min read, 12 to send. plus fixed hardcoded deviceId

parent 583f6020
......@@ -134,9 +134,9 @@ int16_t teal_mallet_gsm::sendReadings(PGM_P *param, PGM_P *quali, PGM_P *dtype,
// then send the actual headers
s->print(F("POST "));
s->print(F("/api/"));
s->print(F("a3b40af1-16b5-4727-bcdc-60b0816a1e7b"));
s->print(_entityId);
s->print(F("/station/"));
s->print(F("a6c33855-49a0-5858-8ffe-3da7c2b0412d"));
s->print(_deviceId);
s->print(F("/measurements"));
s->println(F(" HTTP/1.1"));
s->print(F("Host: "));
......@@ -212,9 +212,9 @@ int8_t teal_mallet_gsm::buildAMON(PGM_P *param, PGM_P *quali, PGM_P *dtype, PGM_
json.openArray();
json.openObject();
json.writeKey(F("deviceId"));
json.writeValue(F("a6c33855-49a0-5858-8ffe-3da7c2b0412d"));
json.writeValue(_deviceId);
json.writeKey(F("entityId"));
json.writeValue(F("a3b40af1-16b5-4727-bcdc-60b0816a1e7b"));
json.writeValue(_entityId);
json.writeKey(F("readings"));
json.openArray();
char buff[SHORT_BUFF]; // need a short buffer to cast the progmem strings into
......
......@@ -15,14 +15,14 @@ File myFile;
#define MAX_DEPTH 15000 // sensor to bed depth in mm
// set > 0 to get debug serial output
#define DEBUG_MODE 1
#define DEBUG_MODE 0
// choose processor sleep mode (1 = on)
#define SLEEP_MODE_ON 1
// store each char array for datastream info as progmem strings
const char level_param[] PROGMEM = "Level";
const char level_quali[] PROGMEM = "1 min";
const char level_quali[] PROGMEM = "15 min";
const char level_dtype[] PROGMEM = "STAGE";
const char level_units[] PROGMEM = "mm";
const char level_perid[] PROGMEM = "INSTANT";
......@@ -47,7 +47,7 @@ state_machine_e g_current_state = SLEEP_IDLE;
t_SensorData last_reading_time;
#define ORDINAL_INTERVAL 1
#define NUM_MMNT 11 // measurement buffer length
#define NUM_MMNT 13 // measurement buffer length
// then create a pre-sized array of these structs to hold a set of timestamped measurements
uint8_t num_mmnt = NUM_MMNT;
t_measurement measurements[NUM_MMNT] = {};
......@@ -58,7 +58,7 @@ uint8_t readings_tail = 0;
// sends happen after a fixed number of ordinals
t_SensorData last_sending_time;
// how many readings should be collected for sending (<NUM_MMNT)
#define NUM_TO_SEND 10
#define NUM_TO_SEND 12
#if NUM_TO_SEND >= NUM_MMNT
#error "Can't hold all the readings, reduce NUM_TO_SEND below NUM_MMNT"
......@@ -140,8 +140,10 @@ void sleep_idle() {
delay(50);
#endif
// sleep is only for 4 seconds-ish
sleep_mode(); // trigger the sleep
/* ...time passes ... */
for (int i=0; i<12; i++) {
sleep_mode(); // trigger the sleep
/* ...time passes ... */
}
sleep_disable(); // prevent further sleeps
#if DEBUG_MODE > 0
#if DEBUG_MODE > 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment