1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-06-07 16:55:23 +02:00

Resolved warnings

This commit is contained in:
Asbelos 2025-05-30 08:34:56 +01:00
parent f163e171e4
commit bdbfc95284
10 changed files with 50 additions and 30 deletions

View File

@ -1079,6 +1079,9 @@ void DCC::displayCabList(Print * stream) {
}
void DCC::setLocoInBlock(int loco, uint16_t blockid, bool exclusive) {
// avoid unused warnings when EXRAIL not active
(void)loco; (void)blockid; (void)exclusive;
// update block loco is in, tell exrail leaving old block, and entering new.
// NOTE: The loco table scanning is really inefficient and needs rewriting
@ -1107,7 +1110,8 @@ void DCC::setLocoInBlock(int loco, uint16_t blockid, bool exclusive) {
}
void DCC::clearBlock(uint16_t blockid) {
// Railcom reports block empty... tell Exrail about all leavers
(void)blockid; // avoid unused warning when EXRAIL not active
// clear block occupied by loco, tell exrail about all leavers
#ifdef EXRAIL_ACTIVE
SLOTLOOP {
if (slot->loco==0) break; // no more locos

View File

@ -109,9 +109,9 @@ uint16_t DCCQueue::lastSentPacketLocoId=0; // used to prevent two packets to the
// kill any existing throttle packets for this loco (or all locos if broadcast)
// this will also remove any estop packets for this loco (or all locos if broadcast) but they will be replaced
PendingSlot * pNext;
PendingSlot * pNext=nullptr;
for (auto p=highPriorityQueue->head;p;p=pNext) {
auto pNext=p->next; // save next packet in case we recycle this one
pNext=p->next; // save next packet in case we recycle this one
if (p->type!=ACC_OFF_PACKET && (loco==0 || p->locoId==loco)) {
// remove this slot from the queue or it will interfere with our ESTOP
highPriorityQueue->remove(p);

View File

@ -73,6 +73,8 @@ public:
}
void _writeAnalogue(VPIN vpin, int value, uint8_t profile, uint16_t duration) override {
(void)profile; // suppress warning, not used in this function
(void)duration; // suppress warning, not used in this function
int pin=vpin - _firstVpin;
_pinValues[pin]=value; // this is analog write
}

View File

@ -72,6 +72,8 @@ const byte _DIR_MASK = 0x30;
void EncoderThrottle::_loop(unsigned long currentMicros) {
(void) currentMicros; // suppress warning
if (_locoid==0) return; // not in use
// Clicking down on the roco, stops the loco and sets the direction as unknown.
@ -118,9 +120,10 @@ const byte _DIR_MASK = 0x30;
}
}
// Selocoid as analog value to start drive
// Set locoid as analog value to start drive
// use <z vpin locoid [notch]>
void EncoderThrottle::_writeAnalogue(VPIN vpin, int value, uint8_t param1, uint16_t param2) {
(void)vpin; // not used, but needed to match IODevice interface
(void) param2;
_locoid=value;
if (param1>0) _notch=param1;

View File

@ -197,6 +197,7 @@ public:
// Check for incoming data, and update busy flag and other state accordingly
void processIncoming(unsigned long currentMicros) {
(void)currentMicros; // suppress warning, not used in this function
// Expected message is in the form "7E FF 06 3D xx xx xx xx xx EF"
RX_fifo_lvl();
if (FIFO_RX_LEVEL >= 10) {
@ -308,7 +309,7 @@ public:
sendPacket(0x0C,0,0);
_resetCmd = false;
} else if(_volCmd == true) { // do the volme before palying a track
if(_requestedVolumeLevel >= 0 && _requestedVolumeLevel <= 30){
if(_requestedVolumeLevel <= 30) {
_currentVolume = _requestedVolumeLevel; // If _requestedVolumeLevel is out of range, sent _currentV1olume
}
sendPacket(0x06, 0x00, _currentVolume);
@ -407,6 +408,9 @@ public:
// Write to a vPin will do nothing
void _write(VPIN vpin, int value) override {
(void)vpin; // suppress warning, not used in this function
(void)value; // suppress warning, not used in this function
if (_deviceState == DEVSTATE_FAILED) return;
#ifdef DIAG_IO
DIAG(F("I2CDFPlayer: Writing to any vPin not supported"));

View File

@ -77,6 +77,7 @@ void I2CRailcom::create(VPIN firstVpin, int nPins, I2CAddress i2cAddress) {
void I2CRailcom::_loop(unsigned long currentMicros) {
(void)currentMicros; // not used, but needed to match IODevice interface
// Read responses from device
if (_deviceState!=DEVSTATE_NORMAL) return;

View File

@ -136,6 +136,7 @@ private:
// Return the position sent by the rotary encoder software
int _readAnalogue(VPIN vpin) override {
(void)vpin; // suppress warning, not used in this function
if (_deviceState == DEVSTATE_FAILED) return 0;
return _position;
}
@ -153,6 +154,8 @@ private:
// To be valid, must be 0 to 255, and different to the current position
// If the current position is the same, it was initiated by the rotary encoder
void _writeAnalogue(VPIN vpin, int position, uint8_t profile, uint16_t duration) override {
(void)profile; // suppress warning, not used in this function
(void)duration; // suppress warning, not used in this function
if (vpin == _firstVpin + 2) {
if (position >= 0 && position <= 255 && position != _position) {
byte newPosition = position & 0xFF;

View File

@ -1,5 +1,5 @@
ECHO ON
FOR /F "delims=" %%i IN ('dir %TMP%\arduino\sketches\CommandStation-EX.ino.elf /s /b /o-D') DO SET ELF=%%i
FOR /F "delims=" %%i IN ('dir %TMP%\CommandStation-EX.ino.elf /s /b /o-D') DO SET ELF=%%i
SET DUMP=%TEMP%\OBJDUMP.txt
echo Most recent subfolder: %ELF% >%DUMP%

View File

@ -32,7 +32,7 @@ upload_protocol = sam-ba
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -std=c++17
build_flags = -std=c++17 ${env.build_flags}
[env:samd21-zero-usb]
platform = atmelsam
@ -42,7 +42,7 @@ upload_protocol = sam-ba
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -std=c++17
build_flags = -std=c++17 ${env.build_flags}
[env:Arduino-M0]
platform = atmelsam
@ -51,7 +51,7 @@ framework = arduino
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -std=c++17
build_flags = -std=c++17 ${env.build_flags}
[env:mega2560-debug]
platform = atmelavr
@ -63,7 +63,7 @@ lib_deps =
SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = -DDIAG_IO=2 -DDIAG_LOOPTIMES
build_flags = -DDIAG_IO=2 -DDIAG_LOOPTIMES ${env.build_flags}
[env:mega2560-no-HAL]
platform = atmelavr
@ -75,7 +75,7 @@ lib_deps =
SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = -DIO_NO_HAL
build_flags = -DIO_NO_HAL ${env.build_flags}
[env:mega2560-I2C-wire]
platform = atmelavr
@ -87,7 +87,7 @@ lib_deps =
SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = -DI2C_USE_WIRE
build_flags = -DI2C_USE_WIRE ${env.build_flags}
[env:mega2560]
platform = atmelavr
@ -106,7 +106,7 @@ lib_ignore = WiFi101
monitor_speed = 115200
monitor_echo = yes
build_flags =
build_flags = ${env.build_flags}
[env:mega2560-eth]
platform = atmelavr
@ -123,6 +123,7 @@ lib_ignore = WiFi101
WiFiNINA_Generic
monitor_speed = 115200
monitor_echo = yes
build_flags = ${env.build_flags}
[env:mega328]
platform = atmelavr
@ -134,6 +135,7 @@ lib_deps =
SPI
monitor_speed = 115200
monitor_echo = yes
build_flags= ${env.build_flags}
[env:unowifiR2]
platform = atmelmegaavr
@ -145,7 +147,7 @@ lib_deps =
SPI
monitor_speed = 115200
monitor_echo = yes
build_flags = "-DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO_WIFI_DEV_ED -DARDUINO_ARCH_AVR -DESP_CH_UART -DESP_CH_UART_BR=19200"
build_flags = ${env.build_flags} "-DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO_WIFI_DEV_ED -DARDUINO_ARCH_AVR -DESP_CH_UART -DESP_CH_UART_BR=19200"
[env:nanoevery]
platform = atmelmegaavr
@ -158,7 +160,7 @@ lib_deps =
monitor_speed = 115200
monitor_echo = yes
upload_speed = 19200
build_flags =
build_flags = ${env.build_flags}
[env:uno]
platform = atmelavr
@ -167,7 +169,7 @@ framework = arduino
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -mcall-prologues
build_flags = -mcall-prologues ${env.build_flags}
[env:nano]
platform = atmelavr
@ -177,7 +179,7 @@ framework = arduino
lib_deps = ${env.lib_deps}
monitor_speed = 115200
monitor_echo = yes
build_flags = -mcall-prologues
build_flags = -mcall-prologues ${env.build_flags}
[env:ESP32]
; Lock version to 6.7.0 as that is
@ -188,7 +190,7 @@ platform = espressif32 @ 6.7.0
board = esp32dev
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17
build_flags = -std=c++17 -${env.build_flags}
monitor_speed = 115200
monitor_echo = yes
@ -197,7 +199,7 @@ platform = ststm32 @ 19.0.0
board = nucleo_f411re
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17 -Os -g2 -Wunused-variable
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes
@ -206,7 +208,7 @@ platform = ststm32 @ 19.0.0
board = nucleo_f446re
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17 -Os -g2 -Wunused-variable
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes
@ -218,7 +220,7 @@ platform = ststm32 @ 19.0.0
board = nucleo_f401re
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17 -Os -g2 -Wunused-variable
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes
@ -243,7 +245,7 @@ platform = ststm32 @ 19.0.0
board = nucleo_f446ze
framework = arduino
lib_deps = ${env.lib_deps}
build_flags = -std=c++17 -Os -g2 -Wunused-variable
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
monitor_speed = 115200
monitor_echo = yes
@ -274,7 +276,7 @@ lib_ignore = WiFi101
WiFiEspAT
WiFiMulti_Generic
WiFiNINA_Generic
build_flags = -std=c++17 -Os -g2 -Wunused-variable -DCUSTOM_PERIPHERAL_PINS
build_flags = -std=c++17 -Os -g2 ${env.build_flags} -DCUSTOM_PERIPHERAL_PINS
monitor_speed = 115200
monitor_echo = yes
upload_protocol = stlink
@ -293,7 +295,7 @@ lib_ignore = WiFi101
WiFiEspAT
WiFiMulti_Generic
WiFiNINA_Generic
build_flags = -std=c++17 -Os -g2 -Wunused-variable -DCUSTOM_PERIPHERAL_PINS
build_flags = -std=c++17 -Os -g2 ${env.build_flags} -DCUSTOM_PERIPHERAL_PINS
monitor_speed = 115200
monitor_echo = yes
upload_protocol = stlink
@ -302,7 +304,7 @@ upload_protocol = stlink
platform = teensy
board = teensy31
framework = arduino
build_flags = -std=c++17 -Os -g2
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet
@ -310,7 +312,7 @@ lib_ignore = NativeEthernet
platform = teensy
board = teensy35
framework = arduino
build_flags = -std=c++17 -Os -g2
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet
@ -318,7 +320,7 @@ lib_ignore = NativeEthernet
platform = teensy
board = teensy36
framework = arduino
build_flags = -std=c++17 -Os -g2
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet
@ -326,7 +328,7 @@ lib_ignore = NativeEthernet
platform = teensy
board = teensy40
framework = arduino
build_flags = -std=c++17 -Os -g2
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore = NativeEthernet
@ -334,6 +336,6 @@ lib_ignore = NativeEthernet
platform = teensy
board = teensy41
framework = arduino
build_flags = -std=c++17 -Os -g2
build_flags = -std=c++17 -Os -g2 ${env.build_flags}
lib_deps = ${env.lib_deps}
lib_ignore =

View File

@ -3,7 +3,8 @@
#include "StringFormatter.h"
#define VERSION "5.5.28"
#define VERSION "5.5.29"
// 5.2.29 - Resolved compiler warnings
// 5.5.28 - DCC Queue memory leak fix
// 5.5.27 - PCF8574 output pin initialization parameter
// 5.5.26 - PCA9554 and TCA9554/9534 I2C 8-bit GPIO expander drivers