RENAMED TO BTCDieselHeater.ino from SenderTrial2.ino - Using DebugPort in BTCWifi.cpp

This commit is contained in:
rljonesau 2018-11-06 14:23:28 +11:00
parent 4a841f530a
commit d57f74482f
37 changed files with 18 additions and 16 deletions

View file

@ -1,7 +1,7 @@
{
"board": "esp32:esp32:esp32",
"port": "192.168.0.101",
"sketch": "SenderTrial2.ino",
"sketch": "BTCDieselHeater.ino",
"output": "..\\build",
"configuration": "PSRAM=disabled,PartitionScheme=default,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none"
}

View file

@ -16,7 +16,7 @@
// limit rate of Bluetooth delivery from enthusiastic OEM controllers
//
#define OEM_TO_BLUETOOTH_MODERATION_TIME 700
// show when we did not echo data frames to bluetooth
// show when we did moderate data frames to bluetooth
#define REPORT_SUPPRESSED_OEM_DATA_FRAMES 0

View file

@ -222,7 +222,12 @@ CHeaterStorage* pNVStorage = NULL;
void setup() {
// initWifi(TRIGGER_PIN, FAILEDSSID, FAILEDPASSWORD);
// initialise serial monitor on serial port 0
// this is the usual USB connection to a PC
// DO THIS BEFORE WE TRY AND SEND DEBUG INFO!
DebugPort.begin(115200);
initWifi(WiFi_TriggerPin, FAILEDSSID, FAILEDPASSWORD);
initOTA();
pinMode(Tx2Pin, OUTPUT);
@ -245,10 +250,6 @@ void setup() {
pinMode(Rx1Pin, INPUT_PULLUP); // required for MUX to work properly
#endif
// initialise serial monitor on serial port 0
// this is the usual USB connection to a PC
DebugPort.begin(115200);
// prepare for first long delay detection
lastRxTime = millis();

View file

@ -1,5 +1,6 @@
// Should be working - Jimmy C
#include "BTCWifi.h"
#include "DebugPort.h"
// select which pin will trigger the configuration portal when set to LOW
WiFiManager wm;
@ -32,16 +33,16 @@ void initWifi(int initpin,const char *failedssid, const char *failedpassword)
res = wm.autoConnect(); // auto generated AP name from chipid
if(!res) {
Serial.println("Failed to connect");
Serial.println("Setting up ESP as AP");
DebugPort.println("Failed to connect");
DebugPort.println("Setting up ESP as AP");
WiFi.softAP(failedssid, failedpassword);
}
else {
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
DebugPort.println("connected...yeey :)");
DebugPort.println("Ready");
DebugPort.print("IP address: ");
DebugPort.println(WiFi.localIP());
}
}
@ -50,7 +51,7 @@ void doWiFiManager(){
if(portalRunning){
wm.process();
if((millis()-startTime) > (timeout*1000)){
Serial.println("portaltimeout");
DebugPort.println("portaltimeout");
portalRunning = false;
if(startCP){
wm.stopConfigPortal();
@ -64,13 +65,13 @@ void doWiFiManager(){
// is configuration portal requested?
if(TRIG_PIN == 1 && (!portalRunning)) {
if(startCP){
Serial.println("Button Pressed, Starting Config Portal");
DebugPort.println("Button Pressed, Starting Config Portal");
wm.setConfigPortalBlocking(false);
wm.startConfigPortal();
TRIG_PIN = 0; // reset the flag
}
else{
Serial.println("Button Pressed, Starting Web Portal");
DebugPort.println("Button Pressed, Starting Web Portal");
wm.startWebPortal();
TRIG_PIN = 0; // reset the flag
}