Compare commits
No commits in common. "95d968a920012bd1d7827f764537404c52eda3e8" and "0a3a39a7e8366a06b8b4269c6d2d06426629924c" have entirely different histories.
95d968a920
...
0a3a39a7e8
|
@ -12,7 +12,7 @@
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = wt32-eth01
|
board = wt32-eth01
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps = siwats/ESPMegaPROR3@^1.2.2
|
lib_deps = siwats/ESPMegaPROR3@^1.2.1
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
ivanseidel/ArduinoThread@^2.1.1
|
ivanseidel/ArduinoThread@^2.1.1
|
||||||
arduino-libraries/Arduino_BuiltIn@^1.0.0
|
arduino-libraries/Arduino_BuiltIn@^1.0.0
|
||||||
|
|
29
src/main.cpp
29
src/main.cpp
|
@ -8,8 +8,7 @@
|
||||||
#include <IRremote.hpp>
|
#include <IRremote.hpp>
|
||||||
#include <daikin_ir.hpp>
|
#include <daikin_ir.hpp>
|
||||||
#include <dhtnew.h>
|
#include <dhtnew.h>
|
||||||
#include <time.h>
|
#include "EasyNextionLibrary.h"
|
||||||
#include <EasyNextionLibrary.h>
|
|
||||||
#include <lcd.hpp>
|
#include <lcd.hpp>
|
||||||
|
|
||||||
// Network Connectivity
|
// Network Connectivity
|
||||||
|
@ -30,7 +29,6 @@ char STATE_REQUEST_TOPIC[40];
|
||||||
const char MQTT_USERNAME[] = "username";
|
const char MQTT_USERNAME[] = "username";
|
||||||
const char MQTT_PASSWORD[] = "password";
|
const char MQTT_PASSWORD[] = "password";
|
||||||
#endif
|
#endif
|
||||||
uint8_t utc_offset = 7;
|
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
#define VINT_COUNT 16
|
#define VINT_COUNT 16
|
||||||
|
@ -208,6 +206,7 @@ void setup()
|
||||||
IrSender.begin(IR_SEND_PIN);
|
IrSender.begin(IR_SEND_PIN);
|
||||||
lcd_send_command("boot_state.txt=\"Network Initializing . . .\"");
|
lcd_send_command("boot_state.txt=\"Network Initializing . . .\"");
|
||||||
network_begin();
|
network_begin();
|
||||||
|
Serial.println("Initializing MQTT . . .");
|
||||||
lcd_send_command("boot_state.txt=\"IoT Core Initializing . . .\"");
|
lcd_send_command("boot_state.txt=\"IoT Core Initializing . . .\"");
|
||||||
mqtt_connect();
|
mqtt_connect();
|
||||||
lcd_send_command("boot_state.txt=\"Threads Initializing . . .\"");
|
lcd_send_command("boot_state.txt=\"Threads Initializing . . .\"");
|
||||||
|
@ -324,20 +323,14 @@ void network_begin()
|
||||||
ETH.setHostname(HOSTNAME);
|
ETH.setHostname(HOSTNAME);
|
||||||
ETH.config(IP, GATEWAY, SUBNET, DNS, DNS);
|
ETH.config(IP, GATEWAY, SUBNET, DNS, DNS);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
lcd_send_command("boot_state.txt=\"Ethernet Core Initializing \"");
|
|
||||||
delay(500);
|
|
||||||
lcd_send_command("boot_state.txt=\"Ethernet Core Initializing . \"");
|
|
||||||
delay(500);
|
|
||||||
lcd_send_command("boot_state.txt=\"Ethernet Core Initializing . . \"");
|
|
||||||
delay(500);
|
|
||||||
lcd_send_command("boot_state.txt=\"Ethernet Core Initializing . . .\"");
|
lcd_send_command("boot_state.txt=\"Ethernet Core Initializing . . .\"");
|
||||||
delay(500);
|
delay(500);
|
||||||
lcd_send_command("boot_state.txt=\"NTP Core Initializing . . .\"");
|
lcd_send_command("boot_state.txt=\"MQTT Core Initializing . . .\"");
|
||||||
|
delay(1250);
|
||||||
|
lcd_send_command("boot_state.txt=\"FRAM Initializing . . .\"");
|
||||||
|
delay(325);
|
||||||
|
lcd_send_command("boot_state.txt=\"Software Initializing . . .\"");
|
||||||
delay(500);
|
delay(500);
|
||||||
char ntp[19];
|
|
||||||
MQTT_SERVER.toString().toCharArray(ntp,19);
|
|
||||||
ESPMega_configNTP(utc_offset*3600,0,ntp);
|
|
||||||
ESPMega_updateTimeFromNTP();
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,9 +817,9 @@ void lcd_refresh()
|
||||||
void lcd_top_bar_update()
|
void lcd_top_bar_update()
|
||||||
{
|
{
|
||||||
char time_buffer[15];
|
char time_buffer[15];
|
||||||
rtctime_t time = ESPMega_getTime();
|
//rtctime_t time = ESPMega_getTime();
|
||||||
sprintf(time_buffer, "%02d:%02d",time.hours,time.minutes);
|
//sprintf(time_buffer, "%02d:%02d",time.hours,time.minutes);
|
||||||
panel.writeStr("time.txt", time_buffer);
|
//panel.writeStr("time.txt", time_buffer);
|
||||||
panel.writeNum("server.pic", standalone ? 4 : 5);
|
panel.writeNum("server.pic", standalone ? 4 : 5);
|
||||||
panel.writeNum("lan.pic", ETH.linkUp() ? 3 : 2);
|
panel.writeNum("lan.pic", ETH.linkUp() ? 3 : 2);
|
||||||
}
|
}
|
||||||
|
@ -983,7 +976,7 @@ void set_mqtt_server(String address)
|
||||||
void eeprom_ip_update(uint16_t rom_address, uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4)
|
void eeprom_ip_update(uint16_t rom_address, uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4)
|
||||||
{
|
{
|
||||||
uint8_t addressblock[4] = {byte1, byte2, byte3, byte4};
|
uint8_t addressblock[4] = {byte1, byte2, byte3, byte4};
|
||||||
ESPMega_EEPROM.writeBlockVerify(rom_address, addressblock, 4);
|
ESPMega_EEPROM.writeBlock(rom_address, addressblock, 4);
|
||||||
}
|
}
|
||||||
IPAddress eeprom_ip_retrieve(uint16_t rom_address)
|
IPAddress eeprom_ip_retrieve(uint16_t rom_address)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,23 +1,13 @@
|
||||||
#ifndef USER_CODE
|
|
||||||
#define USER_CODE
|
|
||||||
#include <ESPMegaPRO.h>
|
|
||||||
void user_pre_init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void user_init() {
|
void user_init() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void user_loop() {
|
void user_loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
void virtual_interrupt_user_callback(int pin, int state) {
|
void virtual_interrupt_user_callback(int pin, int state) {
|
||||||
|
//Automation: Light Switch
|
||||||
|
|
||||||
}
|
}
|
||||||
void timer_tick_callback() {
|
void timer_tick_callback() {
|
||||||
|
//Automation: Night Light
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue