Commit bda4bc2d authored by Patrick's avatar Patrick

EOD: working level sending, on overnight test for stability

parent 023075bb
......@@ -27,7 +27,7 @@
#define START_BYTE 0xFF
#define END_BYTE 0x00
#define TRANSFER_DELAY 25 // µs spi inter-byte delay
#define PROCESSING_DELAY 100 // no. ms to allow for the slave to process the request
#define PROCESSING_DELAY 10 // no. ms to allow for the slave to process the request
// possible inputs for the_command or the_sensor
enum sensor_e {EMPTY, AVAILABLE, OK, RTC, ADC1, ADC2, ADC3, SDI_12, SET_RTC, SDI_12_FLOAT, SDI_12_SCAN, VERSION};
......
......@@ -27,6 +27,9 @@
#define REPORTING_PERIOD 1000UL*60UL // one minute
#define RECORDING_PERIOD 1000UL*10UL // 10 seconds
#define SIG_FIG 3 // how many significant figures should we print for float readings?
#define SHORT_BUFF 20 // choose the json progmem output buffer length
typedef struct {
char type[30]; // reading:type
char unit[5]; // reading:unit
......@@ -41,6 +44,12 @@ typedef struct{
float level; // then the actual reading as a float, ready to send to teal-mallet
} t_measurement;
// timestamp
typedef struct{
uint16_t y;
uint8_t m, d, hh, mm, ss; //the timestamp in DateTime-ready format
} t_timestamp;
class teal_mallet_gsm
{
private:
......@@ -57,6 +66,8 @@ private:
// character string of set precision from float/double input
char* ftoa(char *a, double f, int precision);
int8_t buildAMON(PGM_P *param, PGM_P *quali, PGM_P *dtype, PGM_P *units, PGM_P *perid, t_measurement* the_measurements, uint8_t num_mmnt, uint8_t read_head, uint8_t read_tail);
public:
//teal_mallet_gsm(Client& aClient);
void begin(char* server, char* deviceId, char* entityId = DEFAULT_ENTITY_ID, int port = 80);
......@@ -70,7 +81,8 @@ public:
uint8_t endConnection(); // close that connection
// send the hash and size headers, followed by a single reading
// returns the http status code
int16_t sendOneReading(uint16_t _y, uint8_t _m, uint8_t _d, uint8_t _hh, uint8_t _mm, uint8_t _ss, double _float_reading, t_SensorType _sensor_type, bool send_to_serial = true);
//int16_t sendOneReading(uint16_t _y, uint8_t _m, uint8_t _d, uint8_t _hh, uint8_t _mm, uint8_t _ss, double _float_reading, t_SensorType _sensor_type, bool send_to_serial = true);
int16_t sendReadings(PGM_P *param, PGM_P *quali, PGM_P *dtype, PGM_P *units, PGM_P *perid, t_measurement* the_measurements, uint8_t num_mmnt, uint8_t read_head, uint8_t read_tail);
};
#endif
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