1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Correcting non-portables merged from master

This commit is contained in:
Asbelos 2021-01-26 11:54:51 +00:00
parent 13593ecf4f
commit 7092f7de33
5 changed files with 20 additions and 8 deletions

View File

@ -400,7 +400,7 @@ const ackOp FLASH LOCO_ID_PROG[] = {
FAIL
};
const ackOp PROGMEM SHORT_LOCO_ID_PROG[] = {
const ackOp FLASH SHORT_LOCO_ID_PROG[] = {
BASELINE,
SETCV,(ackOp)19,
SETBYTE, (ackOp)0,
@ -416,7 +416,7 @@ const ackOp PROGMEM SHORT_LOCO_ID_PROG[] = {
FAIL
};
const ackOp PROGMEM LONG_LOCO_ID_PROG[] = {
const ackOp FLASH LONG_LOCO_ID_PROG[] = {
BASELINE,
// Clear consist CV 19
SETCV,(ackOp)19,

View File

@ -237,7 +237,7 @@ void DCCEXParser::setAtCommandCallback(AT_COMMAND_CALLBACK callback)
}
// Parse an F() string
void DCCEXParser::parse(const __FlashStringHelper * cmd) {
void DCCEXParser::parse(const FSH * cmd) {
int size=strlen_P((char *)cmd)+1;
char buffer[size];
strcpy_P(buffer,(char *)cmd);

View File

@ -19,6 +19,7 @@
#ifndef DCCEXParser_h
#define DCCEXParser_h
#include <Arduino.h>
#include "FSH.h"
typedef void (*FILTER_CALLBACK)(Print * stream, byte & opcode, byte & paramCount, int p[]);
typedef void (*AT_COMMAND_CALLBACK)(const byte * command);
@ -28,7 +29,7 @@ struct DCCEXParser
DCCEXParser();
void loop(Stream & stream);
void parse(Print * stream, byte * command, bool blocking);
void parse(const __FlashStringHelper * cmd);
void parse(const FSH * cmd);
void flush();
static void setFilter(FILTER_CALLBACK filter);
static void setRMFTFilter(FILTER_CALLBACK filter);

17
FSH.h
View File

@ -1,11 +1,24 @@
#ifndef FSH_h
#define FSH_h
/* This is an architecture support file to manage the differences
* between the nano/uno.mega and the later nanoEvery, unoWifiRev2 etc
*
* IMPORTANT:
* To maintain portability the main code should NOT contain ANY references
* to the following:
*
* __FlashStringHelper Use FSH instead.
* PROGMEM use FLASH instead
* pgm_read_byte_near use GETFLASH instead.
*
*/
#include <Arduino.h>
#if defined(ARDUINO_ARCH_MEGAAVR)
#ifdef F
#undef F
#define F(str) (str)
#undef F
#endif
#define F(str) (str)
typedef char FSH;
#define GETFLASH(addr) (*(const unsigned char *)(addr))
#define FLASH

View File

@ -1,8 +1,6 @@
#ifndef MotorDrivers_h
#define MotorDrivers_h
#if defined(ARDUINO_ARCH_MEGAAVR)
#include <Arduino.h>
#endif
// *** PLEASE NOTE *** THIS FILE IS **NOT** INTENDED TO BE EDITED WHEN CONFIGURING A SYSTEM.
// It will be overwritten if the library is updated.