migrate callbacks from std::vector to std::map
This commit is contained in:
parent
c635427d64
commit
5f6e586945
11 changed files with 143 additions and 178 deletions
|
@ -52,37 +52,37 @@ void setup() {
|
|||
espmega.enableIotModule();
|
||||
ETH.begin();
|
||||
espmega.iot->bindEthernetInterface(Ð);
|
||||
NetworkConfig config = {
|
||||
.ip = {192, 168, 0, 11},
|
||||
.gateway = {192, 168, 0, 1},
|
||||
.subnet = {255, 255, 255, 0},
|
||||
.dns1 = {192, 168, 0, 1},
|
||||
.dns2 = {192, 168, 0, 1},
|
||||
.useStaticIp = true,
|
||||
.useWifi = false,
|
||||
.wifiUseAuth = false,
|
||||
};
|
||||
strcpy(config.ssid, "ssid");
|
||||
strcpy(config.password, "password");
|
||||
strcpy(config.hostname, "espmega");
|
||||
Serial.println("Setting network config");
|
||||
espmega.iot->setNetworkConfig(config);
|
||||
espmega.iot->saveNetworkConfig();
|
||||
// espmega.iot->loadNetworkConfig();
|
||||
// NetworkConfig config = {
|
||||
// .ip = {192, 168, 0, 11},
|
||||
// .gateway = {192, 168, 0, 1},
|
||||
// .subnet = {255, 255, 255, 0},
|
||||
// .dns1 = {192, 168, 0, 1},
|
||||
// .dns2 = {192, 168, 0, 1},
|
||||
// .useStaticIp = true,
|
||||
// .useWifi = false,
|
||||
// .wifiUseAuth = false,
|
||||
// };
|
||||
// strcpy(config.ssid, "ssid");
|
||||
// strcpy(config.password, "password");
|
||||
// strcpy(config.hostname, "espmega");
|
||||
// Serial.println("Setting network config");
|
||||
// espmega.iot->setNetworkConfig(config);
|
||||
// espmega.iot->saveNetworkConfig();
|
||||
espmega.iot->loadNetworkConfig();
|
||||
Serial.println("Connecting to network");
|
||||
espmega.iot->connectNetwork();
|
||||
Serial.println("Begin MQTT Modules");
|
||||
MqttConfig mqtt_config = {
|
||||
.mqtt_port = 1883,
|
||||
.mqtt_useauth = false
|
||||
};
|
||||
Serial.println("Setting MQTT Server");
|
||||
strcpy(mqtt_config.mqtt_server, "192.168.0.26");
|
||||
strcpy(mqtt_config.base_topic, "/espmegaoop");
|
||||
Serial.println("Loading MQTT Config Struct to IoT Module");
|
||||
espmega.iot->setMqttConfig(mqtt_config);
|
||||
espmega.iot->saveMqttConfig();
|
||||
// espmega.iot->loadMqttConfig();
|
||||
// MqttConfig mqtt_config = {
|
||||
// .mqtt_port = 1883,
|
||||
// .mqtt_useauth = false
|
||||
// };
|
||||
// Serial.println("Setting MQTT Server");
|
||||
// strcpy(mqtt_config.mqtt_server, "192.168.0.26");
|
||||
// strcpy(mqtt_config.base_topic, "/espmegaoop");
|
||||
// Serial.println("Loading MQTT Config Struct to IoT Module");
|
||||
// espmega.iot->setMqttConfig(mqtt_config);
|
||||
// espmega.iot->saveMqttConfig();
|
||||
espmega.iot->loadMqttConfig();
|
||||
Serial.println("Connecting to MQTT");
|
||||
espmega.iot->connectToMqtt();
|
||||
Serial.println("Registering Output Card");
|
||||
|
@ -112,13 +112,13 @@ void setup() {
|
|||
// Every 20 seconds, dump FRAM 0-500 to serial
|
||||
void loop() {
|
||||
espmega.loop();
|
||||
static uint32_t last_fram_dump = 0;
|
||||
if (millis() - last_fram_dump >= 20000) {
|
||||
last_fram_dump = millis();
|
||||
Serial.println("Dumping FRAM");
|
||||
espmega.dumpFRAMtoSerial(0, 500);
|
||||
Serial.println("Dumping FRAM ASCII");
|
||||
espmega.dumpFRAMtoSerialASCII(0, 500);
|
||||
}
|
||||
// static uint32_t last_fram_dump = 0;
|
||||
// if (millis() - last_fram_dump >= 20000) {
|
||||
// last_fram_dump = millis();
|
||||
// Serial.println("Dumping FRAM");
|
||||
// espmega.dumpFRAMtoSerial(0, 500);
|
||||
// Serial.println("Dumping FRAM ASCII");
|
||||
// espmega.dumpFRAMtoSerialASCII(0, 500);
|
||||
// }
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue