mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 09:36:13 +01:00
ESP8266 specific adaptions
This commit is contained in:
parent
a952ec97d6
commit
9ad3c5b0d7
|
@ -141,12 +141,14 @@ bool MotorDriver::canMeasureCurrent() {
|
|||
* a central value depending on direction.
|
||||
*/
|
||||
int MotorDriver::getCurrentRaw() {
|
||||
if (currentPin==UNUSED_PIN) return 0;
|
||||
if (currentPin==UNUSED_PIN) return 0;
|
||||
int current;
|
||||
#if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41)
|
||||
bool irq = disableInterrupts();
|
||||
current = analogRead(currentPin)-senseOffset;
|
||||
enableInterrupts(irq);
|
||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||
current = analogRead(currentPin)-senseOffset;
|
||||
#else // Uno, Mega and all the TEENSY3* but not TEENSY4*
|
||||
unsigned char sreg_backup;
|
||||
sreg_backup = SREG; /* save interrupt enable/disable state */
|
||||
|
|
|
@ -32,7 +32,12 @@ SerialManager::SerialManager(Stream * myserial) {
|
|||
}
|
||||
|
||||
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);
|
||||
new SerialManager(&Serial);
|
||||
#ifdef SERIAL3_COMMANDS
|
||||
|
|
Loading…
Reference in New Issue
Block a user