Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
Siwat Sirichai | d034152c8a | |
Siwat Sirichai | 1ab2c925c4 | |
Siwat Sirichai | 4f2976401b | |
Siwat Sirichai | dd95cd95a6 | |
Siwat Sirichai | 059e160474 | |
Siwat Sirichai | 68166c9d2a | |
Siwat Sirichai | 94731c011c | |
Siwat Sirichai | 25f2375760 | |
Siwat Sirichai | 1a58b81bc8 | |
Siwat Sirichai | e18a5c97c3 | |
Siwat Sirichai | 435a92b5f8 | |
Siwat Sirichai | 7cde8d63dc |
|
@ -1,6 +1,2 @@
|
|||
<<<<<<< HEAD
|
||||
# WaterishOS-Revision3.0x
|
||||
=======
|
||||
# WaterishOS-Revision2.0x
|
||||
This is Waterish OS Revision 2 for Board v2 based on esp8266
|
||||
>>>>>>> 4ea1442f6cc3a60cf380eb9710072af0624eefff
|
||||
|
|
|
@ -26,9 +26,12 @@
|
|||
#include <Adafruit_MCP23017.h>
|
||||
#include <Thread.h>
|
||||
#include <ThreadController.h>
|
||||
#include <AceButton.h>
|
||||
Adafruit_MCP23017 mcp;
|
||||
using namespace ace_button;
|
||||
long tslr = 0;
|
||||
WiFiClient espClient;
|
||||
boolean allowbuttonint = true;
|
||||
PubSubClient client("siwatsystem.com", 1883, espClient);
|
||||
PubSubClientTools mqtt(client);
|
||||
ThreadController threadControl = ThreadController();
|
||||
|
@ -41,18 +44,23 @@ boolean lastsensorstate[12];
|
|||
boolean firstrun = true;
|
||||
FlowMeter sensor1 = FlowMeter(12);
|
||||
FlowMeter sensor2 = FlowMeter(13);
|
||||
boolean devcon = false;
|
||||
int devconmenu = 0;
|
||||
volatile boolean awakenByInterrupt = false;
|
||||
LiquidCrystal_I2C lcd(0x3F, 16, 2);
|
||||
int menu;
|
||||
void writelcd(String line1, String line2) {
|
||||
if (!devcon) {
|
||||
lcd.clear();
|
||||
lcd.print(line1);
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print(line2);
|
||||
Serial.print("Writing to LCD: " + line1 + " " + line2 + "\n");
|
||||
}
|
||||
}
|
||||
void updatelcd()
|
||||
{
|
||||
writelcd("1: "+String((int)sensor1.getCurrentFlowrate())+"L/h "+String(sensor1.getTotalVolume())+"L","2:"+String((int)sensor2.getCurrentFlowrate())+"L/h "+String(sensor2.getTotalVolume())+"L");
|
||||
if (!devcon)writelcd("1: " + String((int)sensor1.getCurrentFlowrate()) + "L/h " + String(sensor1.getTotalVolume()) + "L", "2:" + String((int)sensor2.getCurrentFlowrate()) + "L/h " + String(sensor2.getTotalVolume()) + "L");
|
||||
}
|
||||
void ICACHE_RAM_ATTR read1() {
|
||||
sensor1.count();
|
||||
|
@ -87,10 +95,12 @@ void espcommander(String topic, String rawcommand) {
|
|||
}
|
||||
//END OF ESPCOMMANDER CODE
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
lcd.begin();
|
||||
writelcd(" Siwat INC (tm) ", " Waterish OS");
|
||||
delay(1000);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect(true);
|
||||
WiFi.begin(ssid, password);
|
||||
int connectionattempt = 0;
|
||||
while (WiFi.status() != WL_CONNECTED && online)
|
||||
|
@ -108,10 +118,10 @@ void setup() {
|
|||
if (online)writelcd(" WiFi Connected", wifiname);
|
||||
delay(3000);
|
||||
writelcd("Boot Sequence P3", " Loading Kernel");
|
||||
Serial.begin(115200);
|
||||
pinMode(14, INPUT_PULLUP);
|
||||
pinMode(12, INPUT);
|
||||
pinMode(13, INPUT);
|
||||
pinMode(0, INPUT_PULLUP);
|
||||
attachInterrupt(digitalPinToInterrupt(12), read1, RISING);
|
||||
attachInterrupt(digitalPinToInterrupt(13), read2, RISING);
|
||||
delay(1000);
|
||||
|
@ -156,5 +166,29 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
if (online)client.loop();
|
||||
threadControl.run();
|
||||
if (!devcon)threadControl.run();
|
||||
}
|
||||
void drawcon() {
|
||||
if (devconmenu == 1) {
|
||||
writelcd("connectionchck.c", "Check Connection");
|
||||
}
|
||||
}
|
||||
void startdevcon() {
|
||||
allowbuttonint = false;
|
||||
devcon = true; //no going back, Delete Waterish OS and Install Siwat INC(R) DEVCON OS
|
||||
writelcd(" SIWAT INC(R) ", "DEVCON OS V3.2.4");
|
||||
delay(1000);
|
||||
writelcd("DEVCON TOOLKITS", "3 Extension Load");
|
||||
delay(1000);
|
||||
writelcd("Initia Extension", "connectionchck.c");
|
||||
delay(2000);
|
||||
writelcd("Initia Extension", "hall_pid_tuner.c");
|
||||
delay(2000);
|
||||
writelcd("Initia Extension", "credit_display.c");
|
||||
delay(2000);
|
||||
writelcd("DEVCON TOOLKITS", "set WTOS at 0x3D");
|
||||
delay(1000);
|
||||
allowbuttonint = true;
|
||||
devconmenu = 1;
|
||||
drawcon();
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue