diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 429e1dc..e4b4d73 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -68,6 +68,8 @@ const int16_t HASH_KEYWORD_VPIN=-415; const int16_t HASH_KEYWORD_C=67; const int16_t HASH_KEYWORD_T=84; const int16_t HASH_KEYWORD_LCN = 15137; +const int16_t HASH_KEYWORD_HAL = 10853; +const int16_t HASH_KEYWORD_SHOW = -21309; #ifdef HAS_ENOUGH_MEMORY const int16_t HASH_KEYWORD_WIFI = -5583; const int16_t HASH_KEYWORD_ETHERNET = -30767; @@ -874,6 +876,13 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[]) IODevice::writeAnalogue(p[1], p[2], params>3 ? p[3] : 0); break; +#if !defined(IO_MINIMAL_HAL) + case HASH_KEYWORD_HAL: + if (p[1] == HASH_KEYWORD_SHOW) + IODevice::DumpAll(); + break; +#endif + default: // invalid/unknown break; } diff --git a/IO_DCCAccessory.cpp b/IO_DCCAccessory.cpp index 139d900..7f3dd93 100644 --- a/IO_DCCAccessory.cpp +++ b/IO_DCCAccessory.cpp @@ -42,12 +42,9 @@ DCCAccessoryDecoder::DCCAccessoryDecoder(VPIN vpin, int nPins, int DCCAddress, i } void DCCAccessoryDecoder::_begin() { - int endAddress = _packedAddress + _nPins - 1; - int DCCAddress = _packedAddress >> 2; - int DCCSubaddress = _packedAddress & 3; - DIAG(F("DCC Accessory Decoder configured Vpins:%d-%d Linear Address:%d-%d (%d/%d-%d/%d)"), _firstVpin, _firstVpin+_nPins-1, - _packedAddress, _packedAddress+_nPins-1, - DCCAddress, DCCSubaddress, endAddress >> 2, endAddress % 4); +#if defined(DIAG_IO) + _display(); +#endif } // Device-specific write function. @@ -61,7 +58,7 @@ void DCCAccessoryDecoder::_write(VPIN id, int state) { void DCCAccessoryDecoder::_display() { int endAddress = _packedAddress + _nPins - 1; - DIAG(F("DCC Accessory Vpins:%d-%d Linear Address:%d-%d (%d/%d-%d/%d)"), _firstVpin, _firstVpin+_nPins-1, + DIAG(F("DCCAccessoryDecoder Configured on Vpins:%d-%d Linear Address:%d-%d (%d/%d-%d/%d)"), _firstVpin, _firstVpin+_nPins-1, _packedAddress, _packedAddress+_nPins-1, _packedAddress >> 2, _packedAddress % 4, endAddress >> 2, endAddress % 4); } diff --git a/IO_ExampleSerial.cpp b/IO_ExampleSerial.cpp index 6954e55..efcc3bf 100644 --- a/IO_ExampleSerial.cpp +++ b/IO_ExampleSerial.cpp @@ -42,7 +42,9 @@ void IO_ExampleSerial::create(VPIN firstVpin, int nPins, HardwareSerial *serial, // Device-specific initialisation void IO_ExampleSerial::_begin() { _serial->begin(_baud); - DIAG(F("ExampleSerial configured Vpins:%d-%d"), _firstVpin, _firstVpin+_nPins-1); +#if defined(DIAG_IO) + _display(); +#endif // Send a few # characters to the output for (uint8_t i=0; i<3; i++) @@ -121,7 +123,7 @@ void IO_ExampleSerial::_loop(unsigned long currentMicros) { } void IO_ExampleSerial::_display() { - DIAG(F("IO_ExampleSerial VPins:%d-%d"), (int)_firstVpin, + DIAG(F("IO_ExampleSerial Configured on VPins:%d-%d"), (int)_firstVpin, (int)_firstVpin+_nPins-1); } diff --git a/IO_GPIOBase.h b/IO_GPIOBase.h index 6e4a032..4ca8cce 100644 --- a/IO_GPIOBase.h +++ b/IO_GPIOBase.h @@ -99,7 +99,9 @@ void GPIOBase::_begin() { I2CManager.begin(); I2CManager.setClock(400000); if (I2CManager.exists(_I2CAddress)) { +#if defined(DIAG_IO) _display(); +#endif _portMode = 0; // default to input mode _portPullup = -1; // default to pullup enabled _portInputState = -1; diff --git a/IO_HCSR04.h b/IO_HCSR04.h index e66c343..98340ff 100644 --- a/IO_HCSR04.h +++ b/IO_HCSR04.h @@ -90,8 +90,9 @@ protected: pinMode(_receivePin, INPUT); ArduinoPins::fastWriteDigital(_transmitPin, 0); _lastExecutionTime = micros(); - DIAG(F("HCSR04 configured on VPIN:%d TXpin:%d RXpin:%d On:%dcm Off:%dcm"), - _firstVpin, _transmitPin, _receivePin, _onThreshold, _offThreshold); +#if defined(DIAG_IO) + _display(); +#endif } // _read function - just return _value (calculated in _loop). @@ -109,6 +110,11 @@ protected: } } + void _display() override { + DIAG(F("HCSR04 Configured on Vpin:%d TrigPin:%d EchoPin:%d On:%dcm Off:%dcm"), + _firstVpin, _transmitPin, _receivePin, _onThreshold, _offThreshold); + } + private: // This polls the HC-SR04 device by sending a pulse and measuring the duration of // the pulse observed on the receive pin. In order to be kind to the rest of the CS