From 758991763882513111443766a22ce18ebc0b5aca Mon Sep 17 00:00:00 2001 From: pmantoine Date: Sat, 8 Apr 2023 14:15:38 +0800 Subject: [PATCH 1/3] STM32 ADCee fix --- DCCTimerSTM32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCCTimerSTM32.cpp b/DCCTimerSTM32.cpp index 83ac99b..de2c235 100644 --- a/DCCTimerSTM32.cpp +++ b/DCCTimerSTM32.cpp @@ -237,7 +237,7 @@ int16_t ADCee::ADCmax() { } int ADCee::init(uint8_t pin) { - uint id = pin - A0; + uint8_t id = pin - A0; int value = 0; PinName stmpin = digitalPin[analogInputPin[id]]; uint32_t stmgpio = stmpin / 16; // 16-bits per GPIO port group on STM32 From 3868bb19ac17da648eacdc0a0d6809b3375aa023 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Sat, 8 Apr 2023 14:51:10 +0800 Subject: [PATCH 2/3] More uint type fixes --- DCCTimerSAMD.cpp | 4 ++-- DCCTimerSTM32.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DCCTimerSAMD.cpp b/DCCTimerSAMD.cpp index 463cc64..f878ae5 100644 --- a/DCCTimerSAMD.cpp +++ b/DCCTimerSAMD.cpp @@ -162,7 +162,7 @@ uint16_t ADCee::usedpins = 0; int * ADCee::analogvals = NULL; int ADCee::init(uint8_t pin) { - uint id = pin - A0; + uint8_t id = pin - A0; int value = 0; if (id > NUM_ADC_INPUTS) @@ -210,7 +210,7 @@ int ADCee::read(uint8_t pin, bool fromISR) { #pragma GCC push_options #pragma GCC optimize ("-O3") void ADCee::scan() { - static uint id = 0; // id and mask are the same thing but it is faster to + static uint8_t id = 0; // id and mask are the same thing but it is faster to static uint16_t mask = 1; // increment and shift instead to calculate mask from id static bool waiting = false; diff --git a/DCCTimerSTM32.cpp b/DCCTimerSTM32.cpp index de2c235..8038d71 100644 --- a/DCCTimerSTM32.cpp +++ b/DCCTimerSTM32.cpp @@ -306,7 +306,7 @@ int ADCee::read(uint8_t pin, bool fromISR) { #pragma GCC push_options #pragma GCC optimize ("-O3") void ADCee::scan() { - static uint id = 0; // id and mask are the same thing but it is faster to + static uint8_t id = 0; // id and mask are the same thing but it is faster to static uint16_t mask = 1; // increment and shift instead to calculate mask from id static bool waiting = false; From c11d8f6359390ae531ee7bd198b2ac2e0306f708 Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Sat, 8 Apr 2023 17:22:39 +0100 Subject: [PATCH 3/3] Add TURNOUTL Macro to EXRAIL Add TURNOUTL Macro to EXRAIL and retrospective update to version.h to record addition of EX-FastClock mods. --- EXRAIL2MacroReset.h | 2 ++ EXRAILMacros.h | 1 + version.h | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index b4ffc6d..181fb5d 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -134,6 +134,7 @@ #undef STOP #undef THROW #undef TURNOUT +#undef TURNOUTL #undef UNJOIN #undef UNLATCH #undef VIRTUAL_SIGNAL @@ -254,6 +255,7 @@ #define STOP #define THROW(id) #define TURNOUT(id,addr,subaddr,description...) +#define TURNOUTL(id,addr,description...) #define UNJOIN #define UNLATCH(sensor_id) #define VIRTUAL_SIGNAL(id) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index ee20c1f..3aa4631 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -361,6 +361,7 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = { #define STOP OPCODE_SPEED,V(0), #define THROW(id) OPCODE_THROW,V(id), #define TURNOUT(id,addr,subaddr,description...) OPCODE_TURNOUT,V(id),OPCODE_PAD,V(addr),OPCODE_PAD,V(subaddr), +#define TURNOUTL(id,addr,description...) TURNOUT(id,(addr-1)/4+1,(addr-1)%4, description) #define UNJOIN OPCODE_UNJOIN,0,0, #define UNLATCH(sensor_id) OPCODE_UNLATCH,V(sensor_id), #define VIRTUAL_SIGNAL(id) diff --git a/version.h b/version.h index a8c8bde..768e8b2 100644 --- a/version.h +++ b/version.h @@ -5,6 +5,7 @@ #define VERSION "4.2.41" +// 4.2.42 - Added EXRAIL TURNOUTL Macro definition // 4.2.41 - Move HAl startup to ASAP in setup() // - Fix DNOU8 output pin setup to all LOW // 4.2.40 - Automatically detect conflicting default I2C devices and disable @@ -72,6 +73,10 @@ // 4.2.11 Exrail IFLOCO feature added // 4.2.10 SIGNAL/SIGNALH bug fix as they were inverted // IO_EXIOExpander.h input speed optimisation +// ONCLOCK and ONCLOCKTIME command added to EXRAIL for EX-FastCLock +// Serial command added for EX-FastClock +// Broadcast added for EX-FastClock +// IO_EXFastClock.h added for I2C FastClock connection // 4.2.9 duinoNodes support // 4.2.8 HIGHMEM (EXRAIL support beyond 64kb) // Withrottle connect/disconnect improvements