1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

ESP8266 specific adaptions

This commit is contained in:
Harald Barth 2022-02-07 00:14:43 +01:00
parent a952ec97d6
commit 9ad3c5b0d7
2 changed files with 9 additions and 2 deletions

View File

@ -147,6 +147,8 @@ int MotorDriver::getCurrentRaw() {
bool irq = disableInterrupts(); bool irq = disableInterrupts();
current = analogRead(currentPin)-senseOffset; current = analogRead(currentPin)-senseOffset;
enableInterrupts(irq); enableInterrupts(irq);
#elif defined(ARDUINO_ARCH_ESP8266)
current = analogRead(currentPin)-senseOffset;
#else // Uno, Mega and all the TEENSY3* but not TEENSY4* #else // Uno, Mega and all the TEENSY3* but not TEENSY4*
unsigned char sreg_backup; unsigned char sreg_backup;
sreg_backup = SREG; /* save interrupt enable/disable state */ sreg_backup = SREG; /* save interrupt enable/disable state */

View File

@ -32,7 +32,12 @@ SerialManager::SerialManager(Stream * myserial) {
} }
void SerialManager::init() { void SerialManager::init() {
while (!Serial && millis() < 5000); // wait max 5s for Serial to start while (!Serial && millis() < 5000) // wait max 5s for Serial to start
#if defined(ARDUINO_ARCH_ESP8266)
yield(); // yield (otherwise chip resets)
#else
; // do nothing
#endif
Serial.begin(115200); Serial.begin(115200);
new SerialManager(&Serial); new SerialManager(&Serial);
#ifdef SERIAL3_COMMANDS #ifdef SERIAL3_COMMANDS