This commit is contained in:
Bluedragon 2022-04-26 17:25:12 +07:00
parent cf5f1986dc
commit 60fa3d9a3f
3 changed files with 3785 additions and 29 deletions

3743
backup/wmain2.dcpx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,20 +16,17 @@ monitor_speed = 115200
lib_deps =
ottowinter/ESPAsyncWebServer-esphome@^2.1.0
esphome/AsyncTCP-esphome@^1.2.2
;SPIFFS
SPIFFS
bblanchon/ArduinoJson@^6.19.4
khoih-prog/ESPAsync_WiFiManager@^1.12.2
rodan/ds3231@^1.0
;fmalpartida/LiquidCrystal@^1.5.0
https://github.com/cyberp/AT24Cx.git
https://github.com/JChristensen/JC_Button.git
Wire
;arduino-libraries/LiquidCrystal@^1.0.7
https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library.git
;https://github.com/mathertel/LiquidCrystal_PCF8574.git
;LiquidCrystal_PCF8574
[env:env1]
lib_deps =
khoih-prog/ESPAsync_WiFiManager@^1.12.2
rodan/ds3231@^1.0
arduino-libraries/LiquidCrystal@^1.0.7

View File

@ -15,11 +15,12 @@
#include <AsyncTCP.h>
#include <AsyncJson.h>
#include <SPIFFS.h>
#else
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <Hash.h>
#include <FS.h>
// #else
// #include <ESP8266WiFi.h>
// #include <ESPAsyncTCP.h>
// #include <Hash.h>
// #include <FS.h>
#endif
#include <ESPAsyncWebServer.h>
// #include <ESPmDNS.h>
@ -92,9 +93,10 @@ bool gGotRequestConstHTML[REQUESTCOUNT];
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#include <Wire.h>
// #include <Wire.h>
#include <ds3231.h>
#include <LiquidCrystal_I2C.h>
// #include <LiquidCrystal_PCF8574.h>
#include <AT24CX.h>
//#define BUFF_MAX 128
@ -151,8 +153,9 @@ const int lcdRows = 4;
#define LED_BUILTIN 22 // LED built in pada ESP32 Lolin32 Lite
// set LCD address, number of columns and rows
// if you don't know your display address, run an I2C scanner sketch
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows); // marcoschwartz. ujungnya jelek ->remark
LiquidCrystal_I2C lcd(0x28, lcdColumns, lcdRows); // marcoschwartz. ujungnya jelek ->remark
LiquidCrystal_I2C lcd2(I2C_ADDR, lcdColumns, lcdRows); // marcoschwartz. ujungnya jelek ->remark
// LiquidCrystal_PCF8574 lcd(0.27);
/*-----( Declare objects )-----*/
//LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
@ -2137,8 +2140,7 @@ void handleloadConst(AsyncWebServerRequest *request, JsonVariant &json) {
}
void setup() {
getCalibJson.reserve(512);
getRallyJson.reserve(512);
//
//
//
@ -2148,13 +2150,16 @@ getRallyJson.reserve(512);
Serial.println("Starting Rally");
//#endif
// pinMode(ledPin, OUTPUT);
uint32_t freqhx=100000;
// Wire.begin(15, 13, freqhx); //for lolin32lite sda=15; scl=13
pinMode(simulatorPWMPin,OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(interruptPin, INPUT); //Pull down using resistor to ground
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, FALLING);
// attachInterrupt(digitalPinToInterrupt(interruptPin), blink, FALLING);
// attachInterrupt(interruptPin, isr, FALLING);
Wire.begin(I2C_SDA, I2C_SCL); //for lolin32lite sda=15; scl=13
// Wire.begin(I2C_SDA, I2C_SCL); //for lolin32lite sda=15; scl=13
// Wire.begin(15, 13); //for lolin32lite sda=15; scl=13
// pinMode(UP_pin, INPUT_PULLUP); ///
// pinMode(DOWN_pin, INPUT_PULLUP); ///
// pinMode(LEFT_pin, INPUT_PULLUP); ///
@ -2168,7 +2173,7 @@ getRallyJson.reserve(512);
btnOK.begin();
btnESC.begin();
//DS3231_init(DS3231_INTCN);
DS3231_init(DS3231_CONTROL_INTCN);
//memset(recv, 0, BUFF_MAX);
#ifdef DEBUG
Serial.println("GET time");
@ -2193,36 +2198,47 @@ Trip[9].startSec = 58;
// lcd.init();
// lcd.backlight();
// lcd.begin(LCD_COLS, LCD_ROWS);
// lcd.setBacklight(0xff);
// Wire.setClock(400000L); // set i2c clock bit rate, if asked
// lcd.begin(20, 4);
// // if(lcd.begin(20, 4))
// // {
// // // begin() failed so blink the onboard LED if possible
// // return; // this never returns
// // }
// lcd.setBacklight(0xff);
// // Wire.setClock(100000L); // set i2c clock bit rate, if asked
// lcd.print("i2c clock:");
// lcd.setCursor(0,1);
// lcd.print(Wire.getClock());
// lcd.print(" Hz");
// delay(3000);
// lcd.print("i2c clock:");
// lcd.setCursor(0,1);
// lcd.print(Wire.getClock());
// lcd.print(" Hz");
// delay(3000);
//**************************LCD Setup********************************
delay(100);
// lcd.begin (20,4); // initialize the lcd
// lcd.init();
lcd.begin();
lcd2.begin();
// Switch on the backlight
/// lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.backlight();
lcd2.backlight();
/// lcd.setBacklight(LED_ON);
lcd2.print("hello rally");
delay(3000);
//***************************END LCD Setup********************************
getCalibJson.reserve(512);
getRallyJson.reserve(512);
#ifdef DEBUG
Serial.println("Setting time");
#endif
//char a[]="304022129022016";
DS3231_init(DS3231_CONTROL_INTCN);
DS3231_get(&t); //Get time
blinkON=false;