-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeteoMessages.h
70 lines (61 loc) · 2.14 KB
/
MeteoMessages.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* MeteoMessages.h
*
* Created on: Oct 6, 2018
* Author: jguillaumes
*/
#ifndef METEOMESSAGES_H_
#define METEOMESSAGES_H_
#include <avr/pgmspace.h>
#define NUM_MESSAGES 15
enum {
CLOCKDET = 0,
CLOCKLST = 1,
THERMNOK = 2,
HYGRONOK = 3,
BAROMNOK = 4,
THERMDET = 5,
THERMLST = 6,
BAROMDET = 7,
BAROMLST = 8,
HYGRODET = 9,
HYGROLST = 10,
TIMEREQS = 11,
WATCHDOG = 12,
COMNDTMO = 13,
BEGINPGM = 14
};
// ....+....1....+....2....+....3....+....4....+....6...
const char PROGMEM MCLOCKDET[] = "HARDW: Clock detected";
const char PROGMEM MCLOCKLST[] = "HARDW: Clock lost!! - Using software timekeeping";
const char PROGMEM MTHERMNOK[] = "HARDW: Thermometer not initialized.";
const char PROGMEM MHYGRONOK[] = "HARDW: Hygrometer not initialized.";
const char PROGMEM MBAROMNOK[] = "HARDW: Barometer not initialized.";
const char PROGMEM MTHERMDET[] = "HARDW: Thermometer detected.";
const char PROGMEM MTHERMLST[] = "HARDW: Thermometer lost.";
const char PROGMEM MBAROMDET[] = "HARDW: Barometer detected.";
const char PROGMEM MBAROMLST[] = "HARDW: Barometer lost.";
const char PROGMEM MHYGRODET[] = "HARDW: Hygrometer detected.";
const char PROGMEM MHYGROLST[] = "HARDW: Hygrometer lost.";
const char PROGMEM MTIMEREQS[] = "TIME?";
const char PROGMEM MWATCHDOG[] = "CRIT : Watchdog triggered, continuing...";
const char PROGMEM MCOMNDTMO[] = "ERROR: Timeout reading command, input ignored";
const char PROGMEM MBEGINPGM[] = "BEGIN:";
class MeteoMessages {
public:
MeteoMessages() {}
virtual ~MeteoMessages() {};
void getMessage(int num, char *buff) {
strcpy_P(buff, messageTable[num]);
}
private:
const char * messageTable[NUM_MESSAGES] = { MCLOCKDET, MCLOCKLST,
MTHERMNOK, MHYGRONOK,
MBAROMNOK,
MTHERMDET, MTHERMLST,
MBAROMDET, MBAROMLST,
MHYGRODET, MHYGROLST,
MTIMEREQS, MWATCHDOG,
MCOMNDTMO, MBEGINPGM };
};
#endif /* METEOMESSAGES_H_ */