refactor for integration of InternalDisplay

This commit is contained in:
Siwat Sirichai 2023-12-30 15:56:05 +07:00
parent d0e4825c2d
commit c224aba193
5 changed files with 33 additions and 43 deletions

View file

@ -16,7 +16,7 @@ void setup() {
espmega.begin();
espmega.enableIotModule();
ETH.begin();
espmega.iot.bindEthernetInterface(&ETH);
espmega.iot->bindEthernetInterface(&ETH);
NetworkConfig config = {
.ip = {192, 168, 0, 11},
.gateway = {192, 168, 0, 1},
@ -31,9 +31,9 @@ void setup() {
strcpy(config.password, "password");
strcpy(config.hostname, "espmega");
Serial.println("Setting network config");
espmega.iot.setNetworkConfig(config);
espmega.iot->setNetworkConfig(config);
Serial.println("Connecting to network");
espmega.iot.connectNetwork();
espmega.iot->connectNetwork();
Serial.println("Begin MQTT Modules");
MqttConfig mqtt_config = {
.mqtt_port = 1883,
@ -43,14 +43,15 @@ void setup() {
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->setMqttConfig(mqtt_config);
Serial.println("Connecting to MQTT");
espmega.iot.connectToMqtt();
espmega.iot->connectToMqtt();
Serial.println("Registering cards");
espmega.iot.registerCard(0);
espmega.iot.registerCard(1);
espmega.iot->registerCard(0);
espmega.iot->registerCard(1);
Serial.println("Initialization Routine Complete");
espmega.inputs.registerCallback(input_change_callback);
espmega.enableInternalDisplay(&Serial);
}
void loop() {