Quietened down debug reporting when MQTT or Bluetooth debug menus active.
Single debug report of one wire searches (init only typ.)
This commit is contained in:
parent
f330d812e6
commit
5efce879ce
|
@ -181,7 +181,7 @@ CProtocol DefaultBTCParams(CProtocol::CtrlMode); // defines the default paramet
|
||||||
CSmartError SmartError;
|
CSmartError SmartError;
|
||||||
CKeyPad KeyPad;
|
CKeyPad KeyPad;
|
||||||
CScreenManager ScreenManager;
|
CScreenManager ScreenManager;
|
||||||
TelnetSpy DebugPort;
|
ABTelnetSpy DebugPort;
|
||||||
#if USE_JTAG == 0
|
#if USE_JTAG == 0
|
||||||
CGPIOin GPIOin;
|
CGPIOin GPIOin;
|
||||||
CGPIOout GPIOout;
|
CGPIOout GPIOout;
|
||||||
|
@ -560,7 +560,11 @@ void loop()
|
||||||
|
|
||||||
// precautionary state machine action if all 24 bytes were not received
|
// precautionary state machine action if all 24 bytes were not received
|
||||||
// whilst expecting a frame from the blue wire
|
// 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) ||
|
if( CommState.is(CommStates::OEMCtrlRx) ||
|
||||||
CommState.is(CommStates::HeaterRx1) ||
|
CommState.is(CommStates::HeaterRx1) ||
|
||||||
CommState.is(CommStates::HeaterRx2) ) {
|
CommState.is(CommStates::HeaterRx2) ) {
|
||||||
|
@ -1290,8 +1294,9 @@ void checkDebugCommands()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(MQTTmenu.Handle(rxVal)) {
|
if(MQTTmenu.Handle(rxVal)) {
|
||||||
if(rxVal == 0)
|
if(rxVal == 0) {
|
||||||
showMainmenu();
|
showMainmenu();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,8 @@ CBluetoothHC05::flush()
|
||||||
bool
|
bool
|
||||||
CBluetoothHC05::test(char val)
|
CBluetoothHC05::test(char val)
|
||||||
{
|
{
|
||||||
|
DebugPort.enable(true);
|
||||||
|
|
||||||
if(!val) {
|
if(!val) {
|
||||||
_bTest = false;
|
_bTest = false;
|
||||||
}
|
}
|
||||||
|
@ -277,28 +279,31 @@ CBluetoothHC05::test(char val)
|
||||||
_bTest = true;
|
_bTest = true;
|
||||||
if(val == 0xff) { // special entry command
|
if(val == 0xff) { // special entry command
|
||||||
DebugPort.println("ENTERING Test Bluetooth mode");
|
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");
|
DebugPort.println("LEAVING Test Bluetooth mode");
|
||||||
digitalWrite(_keyPin, LOW); // request HC-05 module to enter command mode
|
digitalWrite(_keyPin, LOW); // request HC-05 module to enter command mode
|
||||||
openSerial(9600);
|
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");
|
DebugPort.println("Test Bluetooth COMMAND mode");
|
||||||
digitalWrite(_keyPin, HIGH); // request HC-05 module to enter command mode
|
digitalWrite(_keyPin, HIGH); // request HC-05 module to enter command mode
|
||||||
openSerial(9600);
|
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");
|
DebugPort.println("Test Bluetooth DATA mode");
|
||||||
digitalWrite(_keyPin, LOW); // request HC-05 module to enter command mode
|
digitalWrite(_keyPin, LOW); // request HC-05 module to enter command mode
|
||||||
openSerial(9600);
|
openSerial(9600);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
HC05_SerialPort.write(val);
|
else {
|
||||||
|
HC05_SerialPort.write(val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_bTest)
|
||||||
|
DebugPort.enable(false);
|
||||||
|
|
||||||
return _bTest;
|
return _bTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,15 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../lib/TelnetSpy/TelnetSpy.h"
|
//#include "../../lib/TelnetSpy/TelnetSpy.h"
|
||||||
|
#include "ABTelnetSpy.h"
|
||||||
|
|
||||||
#ifndef __DEBUGPORT_H__
|
#ifndef __DEBUGPORT_H__
|
||||||
#define __DEBUGPORT_H__
|
#define __DEBUGPORT_H__
|
||||||
|
|
||||||
class CProtocol;
|
class CProtocol;
|
||||||
|
|
||||||
extern TelnetSpy DebugPort;
|
extern ABTelnetSpy DebugPort;
|
||||||
|
|
||||||
void DebugReportFrame(const char* hdr, const CProtocol& Frame, const char* ftr);
|
void DebugReportFrame(const char* hdr, const CProtocol& Frame, const char* ftr);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ CMQTTsetup::setActive()
|
||||||
void
|
void
|
||||||
CMQTTsetup::showMQTTmenu(bool init)
|
CMQTTsetup::showMQTTmenu(bool init)
|
||||||
{
|
{
|
||||||
|
DebugPort.enable(true);
|
||||||
if(init)
|
if(init)
|
||||||
_MQTTsetup = NVstore.getMQTTinfo();
|
_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(" <7> - set enabled, currently %s\r\n", _MQTTsetup.enabled ? "ON" : "OFF");
|
||||||
DebugPort.printf(" <ENTER> - save and exit\r\n");
|
DebugPort.printf(" <ENTER> - save and exit\r\n");
|
||||||
DebugPort.printf(" <ESC> - abort\r\n");
|
DebugPort.printf(" <ESC> - abort\r\n");
|
||||||
|
|
||||||
|
DebugPort.enable(false); // suppress sundry debug whilst MQTT menu is active
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMQTTsetup::Handle(char& rxVal)
|
CMQTTsetup::Handle(char& rxVal)
|
||||||
{
|
{
|
||||||
if(_active) {
|
if(_active) {
|
||||||
|
DebugPort.enable(true);
|
||||||
_active = HandleMQTTsetup(rxVal);
|
_active = HandleMQTTsetup(rxVal);
|
||||||
if(!_active)
|
if(_active)
|
||||||
|
DebugPort.enable(false);
|
||||||
|
else
|
||||||
rxVal = 0;
|
rxVal = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,8 @@ CDS18B20SensorSet::CDS18B20SensorSet()
|
||||||
|
|
||||||
for(int i=0; i<3; i++)
|
for(int i=0; i<3; i++)
|
||||||
_sensorMap[i] = -1;
|
_sensorMap[i] = -1;
|
||||||
|
|
||||||
|
_bReportFind = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -174,6 +176,8 @@ CDS18B20SensorSet::begin(int pin)
|
||||||
_owb = owb_rmt_initialize(&_rmt_driver_info, pin, RMT_CHANNEL_1, RMT_CHANNEL_0);
|
_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
|
owb_use_crc(_owb, true); // enable CRC check for ROM code
|
||||||
|
|
||||||
|
_bReportFind = true;
|
||||||
|
|
||||||
find();
|
find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +232,8 @@ bool
|
||||||
CDS18B20SensorSet::find()
|
CDS18B20SensorSet::find()
|
||||||
{
|
{
|
||||||
// Find all connected devices
|
// 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];
|
OneWireBus_ROMCode rom_codes[MAX_DS18B20_DEVICES];
|
||||||
memset(&rom_codes, 0, sizeof(rom_codes));
|
memset(&rom_codes, 0, sizeof(rom_codes));
|
||||||
|
|
||||||
|
@ -240,13 +245,15 @@ CDS18B20SensorSet::find()
|
||||||
while(found) {
|
while(found) {
|
||||||
char rom_code_s[17];
|
char rom_code_s[17];
|
||||||
owb_string_from_rom_code(search_state.rom_code, rom_code_s, sizeof(rom_code_s));
|
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;
|
rom_codes[_nNumSensors] = search_state.rom_code;
|
||||||
_nNumSensors++;
|
_nNumSensors++;
|
||||||
owb_search_next(_owb, &search_state, &found);
|
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
|
// Create DS18B20 devices on the 1-Wire bus
|
||||||
for (int i = 0; i < MAX_DS18B20_DEVICES; ++i) {
|
for (int i = 0; i < MAX_DS18B20_DEVICES; ++i) {
|
||||||
|
@ -259,7 +266,7 @@ CDS18B20SensorSet::find()
|
||||||
|
|
||||||
if (_nNumSensors == 1)
|
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_init_solo(ds18b20_info, _owb); // only one device on bus
|
||||||
ds18b20_info->rom_code = rom_codes[0]; // added, for GUI setup!!
|
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);
|
ds18b20_set_resolution(ds18b20_info, DS18B20_RESOLUTION_12_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_bReportFind = false;
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ class CDS18B20SensorSet {
|
||||||
|
|
||||||
CDS18B20probe _Sensors[MAX_DS18B20_DEVICES];
|
CDS18B20probe _Sensors[MAX_DS18B20_DEVICES];
|
||||||
int _nNumSensors;
|
int _nNumSensors;
|
||||||
|
bool _bReportFind;
|
||||||
int _sensorMap[MAX_DS18B20_DEVICES];
|
int _sensorMap[MAX_DS18B20_DEVICES];
|
||||||
bool _discover();
|
bool _discover();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
// Place Holder Config File - User config vars and defines to be moved here
|
// Place Holder Config File - User config vars and defines to be moved here
|
||||||
|
|
||||||
#define USE_JTAG 1
|
#define USE_JTAG 0
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Configure bluetooth options
|
// Configure bluetooth options
|
||||||
|
|
Loading…
Reference in a new issue