migate lcdcontrol.h to waterish core

This commit is contained in:
Siwat Sirichai 2019-08-10 20:11:36 +07:00
parent c6d4e288c1
commit 3f6b18b2e2
3 changed files with 79 additions and 44 deletions

View File

@ -25,7 +25,6 @@
#include <Adafruit_MCP23017.h>
#include <Thread.h>
#include <ThreadController.h>
#include "lcdcontrol.h"
Adafruit_MCP23017 mcp;
long tslr = 0;
WiFiClient espClient;
@ -38,6 +37,32 @@ boolean online=true;
FlowMeter sensorA[6] = FlowMeter(1);
FlowMeter sensorB[6] = FlowMeter(3);
volatile boolean awakenByInterrupt = false;
LiquidCrystal_I2C lcd(0x27, 16, 2);
int menu;
void drawmenu()
{
switch (this->menu)
case: '1':
lcd.print(" Waterish OS OK ");
}
};
class disp {
public:
LiquidCrystal_I2C lcd(0x27, 16, 2);
int menu;
void setmenu(int mnp) {
this->menu = mnp;
}
void drawmenu()
{
switch (this->menu)
case: '1':
this->lcd.print(" Waterish OS OK ");
}
};
void readA() {
uint8_t pin = mcp.getLastInterruptPin();
uint8_t val = mcp.getLastInterruptPinValue();
@ -56,7 +81,8 @@ void updatemqtt(){
for (int counter; counter <= 6; counter++)mqtt.publish("/waterishos/node" + nodename + "/flowrateA/" + counter, String(sensorA[counter].getCurrentFlowrate()));
for (int counter; counter <= 6; counter++)mqtt.publish("/waterishos/node" + nodename + "/volumeA/" + counter, String(sensorA[counter].getTotalVolume()));
for (int counter; counter <= 6; counter++)mqtt.publish("/waterishos/node" + nodename + "/flowrateB/" + counter, String(sensorB[counter].getCurrentFlowrate()));
for(int counter;counter<=6;counter++)mqtt.publish("/waterishos/node"+nodename+"/volumeB/"+counter,String(sensorB[counter].getTotalVolume()));}
for (int counter; counter <= 6; counter++)mqtt.publish("/waterishos/node" + nodename + "/volumeB/" + counter, String(sensorB[counter].getTotalVolume()));
}
void setup() {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

View File

@ -3,5 +3,5 @@ const String password = "";
const byte InteruptPinA=1;
const byte InteruptPinB=3;
const byte arduinoInterrupt=1;
const byte buttonPin = 0;
const String nodename="devkit";
#define LCD_I2C '0x27'

View File

@ -1,6 +1,15 @@
class disp {
public:
LiquidCrystal_I2C lcd(LCD_I2C, 16, 2);
int menu();
LiquidCrystal_I2C lcd(0x27, 16, 2);
int menu;
void setmenu(int mnp){
this->menu = mnp;
}
void drawmenu()
{
switch(this->menu)
case: '1':
this->lcd.print(" Waterish OS OK ");
}
};