TelnetSpy added for debug log via telnet (port 23) as well as Serial (USB)
This commit is contained in:
parent
ae51dd2271
commit
e576ec4849
|
@ -110,13 +110,6 @@
|
|||
|
||||
#define RX_DATA_TIMOUT 50
|
||||
|
||||
//comment this out to remove TELNET
|
||||
|
||||
//#define TELNET
|
||||
|
||||
#ifdef TELNET
|
||||
#define DebugPort Debug
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ESP32
|
||||
|
@ -158,6 +151,8 @@ CProtocol DefaultBTCParams(CProtocol::CtrlMode); // defines the default paramet
|
|||
CSmartError SmartError;
|
||||
CKeyPad KeyPad;
|
||||
CScreenManager ScreenManager;
|
||||
TelnetSpy DebugPort;
|
||||
|
||||
|
||||
sRxLine PCline;
|
||||
long lastRxTime; // used to observe inter character delays
|
||||
|
@ -233,11 +228,13 @@ void parentKeyHandler(uint8_t event)
|
|||
|
||||
void setup() {
|
||||
|
||||
// initialise serial monitor on serial port 0
|
||||
// this is the usual USB connection to a PC
|
||||
// initialise TelnetSpy (port 23) as well as Serial to 115200
|
||||
// Serial is the usual USB connection to a PC
|
||||
// DO THIS BEFORE WE TRY AND SEND DEBUG INFO!
|
||||
|
||||
DebugPort.begin(115200);
|
||||
|
||||
|
||||
NVstore.init();
|
||||
NVstore.load();
|
||||
|
||||
|
@ -304,6 +301,8 @@ void loop()
|
|||
float fTemperature;
|
||||
unsigned long timenow = millis();
|
||||
|
||||
DebugPort.handle(); // keep telnet spy alive
|
||||
|
||||
#if USE_WIFI == 1
|
||||
|
||||
doWiFiManager();
|
||||
|
|
|
@ -163,7 +163,7 @@ void interpretJsonCommand(char* pLine)
|
|||
if(strlen(pLine) == 0)
|
||||
return;
|
||||
|
||||
DebugPort.print("JSON parse... "); Serial.print(pLine);
|
||||
DebugPort.print("JSON parse... "); DebugPort.print(pLine);
|
||||
|
||||
JsonObject& obj = jsonBuffer.parseObject(pLine);
|
||||
if(!obj.success()) {
|
||||
|
|
|
@ -26,13 +26,6 @@
|
|||
#include "BluetoothESP32.h"
|
||||
#include "BTCConfig.h"
|
||||
|
||||
#ifdef TELNET
|
||||
#define DebugPort Debug
|
||||
#endif
|
||||
|
||||
#ifndef TELNET
|
||||
#define DebugPort Serial
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ESP32
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "Arduino.h"
|
||||
#include "NVStorage.h"
|
||||
#include "DebugPort.h"
|
||||
|
||||
bool
|
||||
sNVStore::valid()
|
||||
|
@ -31,7 +32,6 @@ sNVStore::valid()
|
|||
retval &= (timer[i].start.min >= 0 && timer[i].start.min < 60);
|
||||
retval &= (timer[i].stop.hour >= 0 && timer[i].stop.hour < 24);
|
||||
retval &= (timer[i].stop.min >= 0 && timer[i].stop.min < 60);
|
||||
// retval &= (timer[i].enabled & 0x80) == 0;
|
||||
retval &= timer[i].repeat < 2;
|
||||
}
|
||||
retval &= Heater.Pmin < 100;
|
||||
|
@ -186,10 +186,10 @@ CESP32HeaterStorage::init()
|
|||
|
||||
void CESP32HeaterStorage::load()
|
||||
{
|
||||
Serial.println("Reading from NV storage");
|
||||
DebugPort.println("Reading from NV storage");
|
||||
preferences.getBytes("calValues", &_calValues, sizeof(sNVStore));
|
||||
if(!_calValues.valid()) {
|
||||
Serial.println("Invalid NV storage, initialising");
|
||||
DebugPort.println("Invalid NV storage, initialising");
|
||||
_calValues.init();
|
||||
save();
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ void CESP32HeaterStorage::load()
|
|||
|
||||
void CESP32HeaterStorage::save()
|
||||
{
|
||||
Serial.println("Saving to NV storage");
|
||||
DebugPort.println("Saving to NV storage");
|
||||
preferences.putBytes("calValues", &_calValues, sizeof(sNVStore));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,6 @@
|
|||
#include "debugport.h"
|
||||
#include "helpers.h"
|
||||
|
||||
#ifdef TELNET
|
||||
#define DebugPort Debug
|
||||
#endif
|
||||
|
||||
#ifndef TELNET
|
||||
#define DebugPort Serial
|
||||
#endif
|
||||
|
||||
unsigned short
|
||||
CProtocol::CalcCRC(int len) const
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
bool collectDataEx(CProtocol& Frame, unsigned char val, int limit = 24) { // returns true when buffer filled
|
||||
// guarding against rogue rx kernel buffer stutters....
|
||||
if((m_Count == 0) && (val != 0x76)) {
|
||||
Serial.println("First heater byte not 0x76 - SKIPPING");
|
||||
DebugPort.println("First heater byte not 0x76 - SKIPPING");
|
||||
return false;
|
||||
}
|
||||
Frame.Data[m_Count++] = val;
|
||||
|
|
|
@ -21,18 +21,14 @@
|
|||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <TelnetSpy.h>
|
||||
|
||||
#ifndef __DEBUGPORT_H__
|
||||
#define __DEBUGPORT_H__
|
||||
|
||||
class CProtocol;
|
||||
|
||||
#if defined(__arm__)
|
||||
// Typically Arduino Due
|
||||
static UARTClass& DebugPort(Serial);
|
||||
#else
|
||||
static HardwareSerial& DebugPort(Serial); // reference Serial as DebugPort
|
||||
#endif
|
||||
extern TelnetSpy DebugPort;
|
||||
|
||||
void DebugReportFrame(const char* hdr, const CProtocol& Frame, const char* ftr);
|
||||
|
||||
|
|
Loading…
Reference in a new issue