Sketch name needs to match the folder.
This commit is contained in:
parent
a0a25f05e2
commit
c5b19e9103
@ -1,59 +0,0 @@
|
|||||||
#include <EEPROM.h>
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
StoreEEPROM()
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void StoreEEPROM() {
|
|
||||||
unsigned char b, e = -1, *p = (uint8_t*)CompileTimeP - 1;
|
|
||||||
while( b = pgm_read_byte( ++p ) ){
|
|
||||||
if( b != EEPROM[++e] ){
|
|
||||||
|
|
||||||
Vessel BoilKettle;
|
|
||||||
strcpy(BoilKettle.name, "boil_kettle");
|
|
||||||
strcpy(BoilKettle.setpoint, BOIL_SETPOINT_TOPIC);
|
|
||||||
strcpy(BoilKettle.sensor, BOIL_ACTUAL_TOPIC);
|
|
||||||
BoilKettle.Rref = RREF_KETTLE;
|
|
||||||
BoilKettle.RNominal = RNOMINAL_KETTLE;
|
|
||||||
|
|
||||||
// Vessel MashTun {mashname, MASH_SETPOINT_TOPIC, MASH_ACTUAL_TOPIC, RREF_MASH, RNOMINAL_MASH};
|
|
||||||
Vessel MashTun;
|
|
||||||
strcpy(MashTun.name, "mash_tun");
|
|
||||||
strcpy(MashTun.setpoint, MASH_SETPOINT_TOPIC);
|
|
||||||
strcpy(MashTun.sensor, MASH_ACTUAL_TOPIC);
|
|
||||||
MashTun.Rref = RREF_MASH;
|
|
||||||
MashTun.RNominal = RNOMINAL_MASH;
|
|
||||||
|
|
||||||
Topic mqtt_topics;
|
|
||||||
strcpy(mqtt_topics.root,TOPIC_ROOT);
|
|
||||||
mqtt_topics.mash = MashTun;
|
|
||||||
mqtt_topics.boil = BoilKettle;
|
|
||||||
|
|
||||||
Mqtt mqtt_data;
|
|
||||||
mqtt_data.broker = MQTT_BROKER;
|
|
||||||
strcpy(mqtt_data.user, MQTT_USER);
|
|
||||||
strcpy(mqtt_data.password, MQTT_PASSWORD);
|
|
||||||
mqtt_data.topic = mqtt_topics;
|
|
||||||
|
|
||||||
ConfigData conf;
|
|
||||||
conf.mqtt = mqtt_data;
|
|
||||||
memcpy(conf.mac, mac, sizeof(mac[0])*6);
|
|
||||||
conf.ip = ip;
|
|
||||||
conf.interval = UpdateInterval;
|
|
||||||
conf.period = PeriodPWM;
|
|
||||||
conf.threshold = ThreshPWR;
|
|
||||||
conf.hysteresis = Hysteresis;
|
|
||||||
|
|
||||||
EEPROM.put(ConfAddress, conf);
|
|
||||||
Serial.println(conf.mqtt.broker);
|
|
||||||
|
|
||||||
while( b = pgm_read_byte( p++ ) ) EEPROM[e++] = b;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
49
eeprom_setup/eeprom_setup.ino
Normal file
49
eeprom_setup/eeprom_setup.ino
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#include <EEPROM.h>
|
||||||
|
#include <Ethernet.h>
|
||||||
|
|
||||||
|
#include "config.h" // Symlinked from boil_kettle sketch
|
||||||
|
#include "datatypes.h" //
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Vessel BoilKettle;
|
||||||
|
strcpy(BoilKettle.name, "boil_kettle");
|
||||||
|
strcpy(BoilKettle.setpoint, BOIL_SETPOINT_TOPIC);
|
||||||
|
strcpy(BoilKettle.sensor, BOIL_ACTUAL_TOPIC);
|
||||||
|
BoilKettle.Rref = RREF_KETTLE;
|
||||||
|
BoilKettle.RNominal = RNOMINAL_KETTLE;
|
||||||
|
|
||||||
|
// Vessel MashTun {mashname, MASH_SETPOINT_TOPIC, MASH_ACTUAL_TOPIC, RREF_MASH, RNOMINAL_MASH};
|
||||||
|
Vessel MashTun;
|
||||||
|
strcpy(MashTun.name, "mash_tun");
|
||||||
|
strcpy(MashTun.setpoint, MASH_SETPOINT_TOPIC);
|
||||||
|
strcpy(MashTun.sensor, MASH_ACTUAL_TOPIC);
|
||||||
|
MashTun.Rref = RREF_MASH;
|
||||||
|
MashTun.RNominal = RNOMINAL_MASH;
|
||||||
|
|
||||||
|
Topic mqtt_topics;
|
||||||
|
strcpy(mqtt_topics.root,TOPIC_ROOT);
|
||||||
|
mqtt_topics.mash = MashTun;
|
||||||
|
mqtt_topics.boil = BoilKettle;
|
||||||
|
|
||||||
|
Mqtt mqtt_data;
|
||||||
|
mqtt_data.broker = MQTT_BROKER;
|
||||||
|
strcpy(mqtt_data.user, MQTT_USER);
|
||||||
|
strcpy(mqtt_data.password, MQTT_PASSWORD);
|
||||||
|
mqtt_data.topic = mqtt_topics;
|
||||||
|
|
||||||
|
ConfigData conf;
|
||||||
|
conf.mqtt = mqtt_data;
|
||||||
|
memcpy(conf.mac, mac, sizeof(mac[0])*6);
|
||||||
|
conf.ip = ip;
|
||||||
|
conf.interval = UpdateInterval;
|
||||||
|
conf.period = PeriodPWM;
|
||||||
|
conf.threshold = ThreshPWR;
|
||||||
|
conf.hysteresis = Hysteresis;
|
||||||
|
|
||||||
|
EEPROM.put(0, conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user