mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-17 10:56:10 +02:00
* moved mqtt loop out of checkTicker
as mentioned in #49
* added irritation and efficiency calculations (** EPPROM CHANGE - YOUR SETTINGS MAYBE BECOME CURRUPT! **) * improved style
This commit is contained in:
parent
8238e90903
commit
7844ea2946
11 changed files with 180 additions and 28 deletions
|
@ -47,6 +47,13 @@ class eep {
|
|||
*value |= (EEPROM.read(addr++));
|
||||
}
|
||||
|
||||
void read(uint32_t addr, uint16_t data[], uint16_t length) {
|
||||
for(uint16_t i = 0; i < length; i ++) {
|
||||
*(data) = (EEPROM.read(addr++) << 8);
|
||||
*(data++) |= (EEPROM.read(addr++));
|
||||
}
|
||||
}
|
||||
|
||||
void read(uint32_t addr, uint32_t *value) {
|
||||
*value = (EEPROM.read(addr++) << 24);
|
||||
*value |= (EEPROM.read(addr++) << 16);
|
||||
|
@ -109,6 +116,14 @@ class eep {
|
|||
EEPROM.commit();
|
||||
}
|
||||
|
||||
|
||||
void write(uint32_t addr, uint16_t data[], uint16_t length) {
|
||||
for(uint16_t i = 0; i < length; i ++) {
|
||||
EEPROM.write(addr++, (data[i] >> 8) & 0xff);
|
||||
EEPROM.write(addr++, (data[i] ) & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
void write(uint32_t addr, uint32_t value) {
|
||||
EEPROM.write(addr++, (value >> 24) & 0xff);
|
||||
EEPROM.write(addr++, (value >> 16) & 0xff);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue