1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-02-16 22:19:14 +01:00

Teensy compatibility issues

This commit is contained in:
Asbelos 2022-01-11 11:22:20 +00:00
parent 41cda58bef
commit 35f7ac3d77
5 changed files with 14 additions and 13 deletions

View File

@ -98,22 +98,20 @@ uint8_t I2CManagerClass::read(uint8_t address, uint8_t readBuffer[], uint8_t rea
* returned in the I2CRB as for the asynchronous version. * returned in the I2CRB as for the asynchronous version.
***************************************************************************/ ***************************************************************************/
void I2CManagerClass::queueRequest(I2CRB *req) { void I2CManagerClass::queueRequest(I2CRB *req) {
uint8_t status;
switch (req->operation) { switch (req->operation) {
case OPERATION_READ: case OPERATION_READ:
status = read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req); req->status = read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
break; break;
case OPERATION_SEND: case OPERATION_SEND:
status = write(req->i2cAddress, req->writeBuffer, req->writeLen, req); req->status = write(req->i2cAddress, req->writeBuffer, req->writeLen, req);
break; break;
case OPERATION_SEND_P: case OPERATION_SEND_P:
status = write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req); req->status = write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req);
break; break;
case OPERATION_REQUEST: case OPERATION_REQUEST:
status = read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req); req->status = read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
break; break;
} }
req->status = status;
} }
/*************************************************************************** /***************************************************************************

View File

@ -681,7 +681,7 @@ void RMFT2::loop2() {
break; break;
case OPCODE_IFRANDOM: // do block on random percentage case OPCODE_IFRANDOM: // do block on random percentage
if (random(100)>=operand) if (!skipIfBlock()) return; if ((int16_t)random(100)>=operand) if (!skipIfBlock()) return;
break; break;
case OPCODE_IFRESERVE: // do block if we successfully RERSERVE case OPCODE_IFRESERVE: // do block if we successfully RERSERVE

View File

@ -22,26 +22,29 @@
#include "DCCEXParser.h" #include "DCCEXParser.h"
SerialManager * SerialManager::first=NULL; SerialManager * SerialManager::first=NULL;
SerialManager::SerialManager(HardwareSerial * myserial) { SerialManager::SerialManager(Stream * myserial) {
serial=myserial; serial=myserial;
next=first; next=first;
first=this; first=this;
bufferLength=0; bufferLength=0;
myserial->begin(115200);
inCommandPayload=false; inCommandPayload=false;
} }
void SerialManager::init() { void SerialManager::init() {
#ifdef SERIAL3_COMMANDS #ifdef SERIAL3_COMMANDS
Serial3.begin(115200);
new SerialManager(&Serial3); new SerialManager(&Serial3);
#endif #endif
#ifdef SERIAL2_COMMANDS #ifdef SERIAL2_COMMANDS
Serial2.begin(115200);
new SerialManager(&Serial2); new SerialManager(&Serial2);
#endif #endif
#ifdef SERIAL1_COMMANDS #ifdef SERIAL1_COMMANDS
Serial1.begin(115200);
new SerialManager(&Serial1); new SerialManager(&Serial1);
#endif #endif
new SerialManager(&Serial); Serial.begin(115200);
new SerialManager(&Serial);
} }
void SerialManager::broadcast(RingStream * ring) { void SerialManager::broadcast(RingStream * ring) {

View File

@ -37,10 +37,10 @@ public:
private: private:
static SerialManager * first; static SerialManager * first;
SerialManager(HardwareSerial * myserial); SerialManager(Stream * myserial);
void loop2(); void loop2();
void broadcast2(RingStream * ring); void broadcast2(RingStream * ring);
HardwareSerial * serial; Stream * serial;
SerialManager * next; SerialManager * next;
byte bufferLength; byte bufferLength;
byte buffer[COMMAND_BUFFER_SIZE]; byte buffer[COMMAND_BUFFER_SIZE];

View File

@ -3,7 +3,7 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "3.2.0 rc10" #define VERSION "3.2.0 rc11"
// 3.2.0 Major functional and non-functional changes. // 3.2.0 Major functional and non-functional changes.
// New HAL added for I/O (digital and analogue inputs and outputs, servos etc). // New HAL added for I/O (digital and analogue inputs and outputs, servos etc).
// Support for MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules. // Support for MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.