mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 13:21:23 +01:00
Make GETFLASHW code more universal
This commit is contained in:
parent
bd8439c2f9
commit
d874ad8cc3
@ -90,9 +90,13 @@ LookList * RMFT2::onDeactivateLookup=NULL;
|
|||||||
LookList * RMFT2::onRedLookup=NULL;
|
LookList * RMFT2::onRedLookup=NULL;
|
||||||
LookList * RMFT2::onAmberLookup=NULL;
|
LookList * RMFT2::onAmberLookup=NULL;
|
||||||
LookList * RMFT2::onGreenLookup=NULL;
|
LookList * RMFT2::onGreenLookup=NULL;
|
||||||
|
|
||||||
#define GET_OPCODE GETFLASH(RMFT2::RouteCode+progCounter)
|
#define GET_OPCODE GETFLASH(RMFT2::RouteCode+progCounter)
|
||||||
|
#ifdef ARDUINO_ARCH_AVR
|
||||||
#define GET_OPERAND(n) GETFLASHW(RMFT2::RouteCode+progCounter+1+(n*3))
|
#define GET_OPERAND(n) GETFLASHW(RMFT2::RouteCode+progCounter+1+(n*3))
|
||||||
|
#else
|
||||||
|
#define GET_OPERAND(n) GETOPW(RMFT2::RouteCode+progCounter+1+(n*3))
|
||||||
|
#define GETOPW(A) (((uint32_t)A)%2 ? GETFLASH((const byte *)A) | (GETFLASH(1+(const byte *)A)<<8) : GETFLASHW(A))
|
||||||
|
#endif
|
||||||
#define SKIPOP progCounter+=3
|
#define SKIPOP progCounter+=3
|
||||||
|
|
||||||
|
|
||||||
|
18
FSH.h
18
FSH.h
@ -37,7 +37,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_MEGAAVR)
|
#if defined(ARDUINO_ARCH_MEGAAVR)
|
||||||
|
|
||||||
#ifdef F
|
#ifdef F
|
||||||
#undef F
|
#undef F
|
||||||
#endif
|
#endif
|
||||||
@ -48,18 +50,26 @@ typedef char FSH;
|
|||||||
#define FLASH
|
#define FLASH
|
||||||
#define strlen_P strlen
|
#define strlen_P strlen
|
||||||
#define strcpy_P strcpy
|
#define strcpy_P strcpy
|
||||||
|
|
||||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32)
|
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32)
|
||||||
|
|
||||||
typedef __FlashStringHelper FSH;
|
typedef __FlashStringHelper FSH;
|
||||||
#define GETFLASH(addr) pgm_read_byte(addr)
|
#define GETFLASH(addr) pgm_read_byte(addr)
|
||||||
#define GETFLASHW(addr) (*(const unsigned int8_t *)(addr)) | ((*(const unsigned int8_t *)(addr+1)) << 8)
|
// pgm_read_word is buggy if addr is odd but here
|
||||||
|
// we do only read well aligned addrs, the others are
|
||||||
|
// taken care about in the GET_OPERAND(n) macro in EXRAIL2.cpp.
|
||||||
|
#define GETFLASHW(addr) pgm_read_word(addr)
|
||||||
#ifdef FLASH
|
#ifdef FLASH
|
||||||
#undef FLASH
|
#undef FLASH
|
||||||
#endif
|
#endif
|
||||||
#define FLASH PROGMEM
|
#define FLASH PROGMEM
|
||||||
#else
|
|
||||||
|
#else // AVR and AVR compat here
|
||||||
|
|
||||||
typedef __FlashStringHelper FSH;
|
typedef __FlashStringHelper FSH;
|
||||||
#define GETFLASH(addr) pgm_read_byte_near(addr)
|
#define GETFLASH(addr) pgm_read_byte_near(addr)
|
||||||
#define GETFLASHW(addr) pgm_read_word_near(addr)
|
#define GETFLASHW(addr) pgm_read_word_near(addr)
|
||||||
#define FLASH PROGMEM
|
#define FLASH PROGMEM
|
||||||
#endif
|
|
||||||
#endif
|
#endif // flash stuff
|
||||||
|
#endif // FSH
|
||||||
|
@ -1 +1 @@
|
|||||||
#define GITHUB_SHA "devel-202211071020Z"
|
#define GITHUB_SHA "devel-202211082310Z"
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "4.2.4"
|
#define VERSION "4.2.5"
|
||||||
|
// 4.2.5 Make GETFLASHW code more universal
|
||||||
|
// FIX: Withrottle roster index
|
||||||
// Ethernet start improvement and link detection
|
// Ethernet start improvement and link detection
|
||||||
// 4.2.4 ESP32 experimental BT support
|
// 4.2.4 ESP32 experimental BT support
|
||||||
// More DC configurations possible and lower frequency
|
// More DC configurations possible and lower frequency
|
||||||
|
Loading…
Reference in New Issue
Block a user