changed pins and server
This commit is contained in:
parent
8f50225d91
commit
5a3612f6d8
28
frontend.ino
28
frontend.ino
@ -17,11 +17,11 @@ bool mqttAvail;
|
|||||||
|
|
||||||
WiFiUDP ntpUDP;
|
WiFiUDP ntpUDP;
|
||||||
NTPClient timeClient(ntpUDP);
|
NTPClient timeClient(ntpUDP);
|
||||||
SSD1306Brzo display(0x3C, 4, 5); //oled display w/ address 0x3C with SDA on GPIO4 and SCL on GPIO5 //address == offset
|
SSD1306Brzo display(0x3C, 5, 4); //oled display w/ address 0x3C with SDA on GPIO4 and SCL on GPIO5 //address == offset
|
||||||
|
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
ESP8266WebServer server(80);
|
ESP8266WebServer server(80);
|
||||||
Adafruit_MQTT_Client mqtt(&client, "192.168.100.102", 1883);
|
Adafruit_MQTT_Client mqtt(&client, "192.168.100.100", 1883);
|
||||||
|
|
||||||
Adafruit_MQTT_Subscribe pressureFeed = Adafruit_MQTT_Subscribe(&mqtt, "pressure");
|
Adafruit_MQTT_Subscribe pressureFeed = Adafruit_MQTT_Subscribe(&mqtt, "pressure");
|
||||||
Adafruit_MQTT_Subscribe inFeed = Adafruit_MQTT_Subscribe(&mqtt, "bmpTemp");
|
Adafruit_MQTT_Subscribe inFeed = Adafruit_MQTT_Subscribe(&mqtt, "bmpTemp");
|
||||||
@ -85,7 +85,7 @@ void loop(){
|
|||||||
}
|
}
|
||||||
server.handleClient();
|
server.handleClient();
|
||||||
MQTT_connect();//check connection and get packets for 0.5s
|
MQTT_connect();//check connection and get packets for 0.5s
|
||||||
mqtt.processPackets(500);
|
mqtt.processPackets(300);
|
||||||
|
|
||||||
mainScreen();//it could be cool and smooth if we could update screen independently, in some kind of separate thread or smthn similar
|
mainScreen();//it could be cool and smooth if we could update screen independently, in some kind of separate thread or smthn similar
|
||||||
|
|
||||||
@ -291,24 +291,22 @@ void mainScreen() {
|
|||||||
|
|
||||||
void displayStatus(int state){
|
void displayStatus(int state){
|
||||||
display.clear();
|
display.clear();
|
||||||
if (state == 0) {
|
display.setFont(ArialMT_Plain_16);
|
||||||
display.setFont(ArialMT_Plain_16);
|
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
|
||||||
|
switch (state) {
|
||||||
|
case 0:
|
||||||
display.drawString(64, 22, "Connected!");
|
display.drawString(64, 22, "Connected!");
|
||||||
|
break;
|
||||||
}
|
case 1:
|
||||||
if (state == 1) {
|
|
||||||
display.setFont(ArialMT_Plain_16);
|
|
||||||
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
|
||||||
display.drawString(64, 22, "Connecting...");
|
display.drawString(64, 22, "Connecting...");
|
||||||
}
|
break;
|
||||||
if (state == 2) {
|
case 2:
|
||||||
display.setFont(ArialMT_Plain_16);
|
|
||||||
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
|
||||||
display.drawString(64, 22, "Not connected!");
|
display.drawString(64, 22, "Not connected!");
|
||||||
display.setFont(ArialMT_Plain_10);
|
display.setFont(ArialMT_Plain_10);
|
||||||
display.setTextAlignment(TEXT_ALIGN_LEFT);
|
display.setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display.drawString(0, 53, "we will die in 10s! :0");
|
display.drawString(0, 53, "we will die in 10s! :0");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
display.display();
|
display.display();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user