Commit 5efce879 authored by Ray Jones's avatar Ray Jones
Browse files

Quietened down debug reporting when MQTT or Bluetooth debug menus active.

Single debug report of one wire searches (init only typ.)
No related merge requests found
Showing with 46 additions and 19 deletions
+46 -19
......@@ -181,7 +181,7 @@ CProtocol DefaultBTCParams(CProtocol::CtrlMode); // defines the default paramet
CSmartError SmartError;
CKeyPad KeyPad;
CScreenManager ScreenManager;
TelnetSpy DebugPort;
ABTelnetSpy DebugPort;
#if USE_JTAG == 0
CGPIOin GPIOin;
CGPIOout GPIOout;
......@@ -560,7 +560,11 @@ void loop()
// precautionary state machine action if all 24 bytes were not received
// whilst expecting a frame from the blue wire
if(RxTimeElapsed > RX_DATA_TIMOUT) {
if(RxTimeElapsed > RX_DATA_TIMOUT) {
if(NVstore.getUserSettings().menuMode == 2)
bReportRecyleEvents = false;
if( CommState.is(CommStates::OEMCtrlRx) ||
CommState.is(CommStates::HeaterRx1) ||
CommState.is(CommStates::HeaterRx2) ) {
......@@ -1290,8 +1294,9 @@ void checkDebugCommands()
return;
}
if(MQTTmenu.Handle(rxVal)) {
if(rxVal == 0)
if(rxVal == 0) {
showMainmenu();
}
return;
}
......
......@@ -270,6 +270,8 @@ CBluetoothHC05::flush()
bool
CBluetoothHC05::test(char val)
{
DebugPort.enable(true);
if(!val) {
_bTest = false;
}
......@@ -277,28 +279,31 @@ CBluetoothHC05::test(char val)
_bTest = true;
if(val == 0xff) { // special entry command
DebugPort.println("ENTERING Test Bluetooth mode");
return true;
}
if(val == ('b' & 0x1f)) { // CTRL-B - leave bluetooth test mode
else if(val == ('b' & 0x1f)) { // CTRL-B - leave bluetooth test mode
DebugPort.println("LEAVING Test Bluetooth mode");
digitalWrite(_keyPin, LOW); // request HC-05 module to enter command mode
openSerial(9600);
return false;
_bTest = false;
}
if(val == ('c' & 0x1f)) { // CTRL-C - data mode
else if(val == ('c' & 0x1f)) { // CTRL-C - data mode
DebugPort.println("Test Bluetooth COMMAND mode");
digitalWrite(_keyPin, HIGH); // request HC-05 module to enter command mode
openSerial(9600);
return true;
}
if(val == ('d' & 0x1f)) { // CTRL-D - data mode
else if(val == ('d' & 0x1f)) { // CTRL-D - data mode
DebugPort.println("Test Bluetooth DATA mode");
digitalWrite(_keyPin, LOW); // request HC-05 module to enter command mode
openSerial(9600);
return true;
}
HC05_SerialPort.write(val);
else {
HC05_SerialPort.write(val);
}
}
if(_bTest)
DebugPort.enable(false);
return _bTest;
}
......
......@@ -20,14 +20,15 @@
*
*/
#include "../../lib/TelnetSpy/TelnetSpy.h"
//#include "../../lib/TelnetSpy/TelnetSpy.h"
#include "ABTelnetSpy.h"
#ifndef __DEBUGPORT_H__
#define __DEBUGPORT_H__
class CProtocol;
extern TelnetSpy DebugPort;
extern ABTelnetSpy DebugPort;
void DebugReportFrame(const char* hdr, const CProtocol& Frame, const char* ftr);
......
......@@ -39,6 +39,7 @@ CMQTTsetup::setActive()
void
CMQTTsetup::showMQTTmenu(bool init)
{
DebugPort.enable(true);
if(init)
_MQTTsetup = NVstore.getMQTTinfo();
......@@ -54,14 +55,19 @@ CMQTTsetup::showMQTTmenu(bool init)
DebugPort.printf(" <7> - set enabled, currently %s\r\n", _MQTTsetup.enabled ? "ON" : "OFF");
DebugPort.printf(" <ENTER> - save and exit\r\n");
DebugPort.printf(" <ESC> - abort\r\n");
DebugPort.enable(false); // suppress sundry debug whilst MQTT menu is active
}
bool
CMQTTsetup::Handle(char& rxVal)
{
if(_active) {
DebugPort.enable(true);
_active = HandleMQTTsetup(rxVal);
if(!_active)
if(_active)
DebugPort.enable(false);
else
rxVal = 0;
return true;
}
......
......@@ -163,6 +163,8 @@ CDS18B20SensorSet::CDS18B20SensorSet()
for(int i=0; i<3; i++)
_sensorMap[i] = -1;
_bReportFind = true;
}
void
......@@ -174,6 +176,8 @@ CDS18B20SensorSet::begin(int pin)
_owb = owb_rmt_initialize(&_rmt_driver_info, pin, RMT_CHANNEL_1, RMT_CHANNEL_0);
owb_use_crc(_owb, true); // enable CRC check for ROM code
_bReportFind = true;
find();
}
......@@ -228,7 +232,8 @@ bool
CDS18B20SensorSet::find()
{
// Find all connected devices
DebugPort.println("Finding one wire bus devices...");
if(_bReportFind)
DebugPort.println("Finding one wire bus devices...");
OneWireBus_ROMCode rom_codes[MAX_DS18B20_DEVICES];
memset(&rom_codes, 0, sizeof(rom_codes));
......@@ -240,13 +245,15 @@ CDS18B20SensorSet::find()
while(found) {
char rom_code_s[17];
owb_string_from_rom_code(search_state.rom_code, rom_code_s, sizeof(rom_code_s));
DebugPort.printf(" %d : %s\r\n", _nNumSensors, rom_code_s);
if(_bReportFind)
DebugPort.printf(" %d : %s\r\n", _nNumSensors, rom_code_s);
rom_codes[_nNumSensors] = search_state.rom_code;
_nNumSensors++;
owb_search_next(_owb, &search_state, &found);
}
DebugPort.printf("Found %d DS18B20 device%s\r\n", _nNumSensors, _nNumSensors==1 ? "" : "s");
if(_bReportFind)
DebugPort.printf("Found %d DS18B20 device%s\r\n", _nNumSensors, _nNumSensors==1 ? "" : "s");
// Create DS18B20 devices on the 1-Wire bus
for (int i = 0; i < MAX_DS18B20_DEVICES; ++i) {
......@@ -259,7 +266,7 @@ CDS18B20SensorSet::find()
if (_nNumSensors == 1)
{
printf("DS18B20 Single device optimisations enabled\n");
DebugPort.print("DS18B20 Single device optimisations enabled\n");
ds18b20_init_solo(ds18b20_info, _owb); // only one device on bus
ds18b20_info->rom_code = rom_codes[0]; // added, for GUI setup!!
}
......@@ -271,6 +278,8 @@ CDS18B20SensorSet::find()
ds18b20_set_resolution(ds18b20_info, DS18B20_RESOLUTION_12_BIT);
}
_bReportFind = false;
return found;
}
......
......@@ -66,6 +66,7 @@ class CDS18B20SensorSet {
CDS18B20probe _Sensors[MAX_DS18B20_DEVICES];
int _nNumSensors;
bool _bReportFind;
int _sensorMap[MAX_DS18B20_DEVICES];
bool _discover();
......
......@@ -23,7 +23,7 @@
// Place Holder Config File - User config vars and defines to be moved here
#define USE_JTAG 1
#define USE_JTAG 0
//////////////////////////////////////////////////////////////////////////////
// Configure bluetooth options
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment