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", "board": "esp32:esp32:esp32",
"port": "192.168.0.101", "port": "192.168.0.101",
"sketch": "SenderTrial2.ino", "sketch": "BTCDieselHeater.ino",
"output": "..\\build", "output": "..\\build",
"configuration": "PSRAM=disabled,PartitionScheme=default,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none" "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 // limit rate of Bluetooth delivery from enthusiastic OEM controllers
// //
#define OEM_TO_BLUETOOTH_MODERATION_TIME 700 #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 #define REPORT_SUPPRESSED_OEM_DATA_FRAMES 0

View file

@ -222,7 +222,12 @@ CHeaterStorage* pNVStorage = NULL;
void setup() { 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); initWifi(WiFi_TriggerPin, FAILEDSSID, FAILEDPASSWORD);
initOTA(); initOTA();
pinMode(Tx2Pin, OUTPUT); pinMode(Tx2Pin, OUTPUT);
@ -245,10 +250,6 @@ void setup() {
pinMode(Rx1Pin, INPUT_PULLUP); // required for MUX to work properly pinMode(Rx1Pin, INPUT_PULLUP); // required for MUX to work properly
#endif #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 // prepare for first long delay detection
lastRxTime = millis(); lastRxTime = millis();

View file

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