mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-25 21:41:23 +01:00
commit
9d0dbf7878
2
DCCEX.h
2
DCCEX.h
@ -10,7 +10,9 @@
|
|||||||
#include "DCCEXParser.h"
|
#include "DCCEXParser.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "WifiInterface.h"
|
#include "WifiInterface.h"
|
||||||
|
#if ETHERNET_ON == true
|
||||||
#include "EthernetInterface.h"
|
#include "EthernetInterface.h"
|
||||||
|
#endif
|
||||||
#include "LCD_Implementation.h"
|
#include "LCD_Implementation.h"
|
||||||
#include "freeMemory.h"
|
#include "freeMemory.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
@ -272,7 +272,8 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Convert JMRI bizarre -1=emergency stop, 0-126 as speeds
|
// Convert DCC-EX protocol speed steps where
|
||||||
|
// -1=emergency stop, 0-126 as speeds
|
||||||
// to DCC 0=stop, 1= emergency stop, 2-127 speeds
|
// to DCC 0=stop, 1= emergency stop, 2-127 speeds
|
||||||
if (tspeed > 126 || tspeed < -1)
|
if (tspeed > 126 || tspeed < -1)
|
||||||
break; // invalid JMRI speed code
|
break; // invalid JMRI speed code
|
||||||
@ -434,7 +435,7 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case 'c': // READ CURRENT <c>
|
case 'c': // READ CURRENT <c>
|
||||||
StringFormatter::send(stream, F("<a %d>"), DCCWaveform::mainTrack.getLastCurrent());
|
StringFormatter::send(stream, F("<a %d>"), DCCWaveform::mainTrack.get1024Current());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'Q': // SENSORS <Q>
|
case 'Q': // SENSORS <Q>
|
||||||
|
@ -57,6 +57,11 @@ class DCCWaveform {
|
|||||||
POWERMODE getPowerMode();
|
POWERMODE getPowerMode();
|
||||||
void checkPowerOverload();
|
void checkPowerOverload();
|
||||||
int getLastCurrent();
|
int getLastCurrent();
|
||||||
|
inline int get1024Current() {
|
||||||
|
if (powerMode == POWERMODE::ON)
|
||||||
|
return (int)(lastCurrent*(long int)1024/motorDriver->getRawCurrentTripValue());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
||||||
volatile bool packetPending;
|
volatile bool packetPending;
|
||||||
volatile byte sentResetsSincePacket;
|
volatile byte sentResetsSincePacket;
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "defines.h" // This should be changed to DCCEX.h when possible
|
||||||
|
#if ETHERNET_ON == true
|
||||||
#include "EthernetInterface.h"
|
#include "EthernetInterface.h"
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include "CommandDistributor.h"
|
#include "CommandDistributor.h"
|
||||||
@ -166,8 +169,6 @@ void EthernetInterface::loop()
|
|||||||
if (Diag::ETHERNET) DIAG(F("Ethernet reply socket=%d, count=:%d\n"), socketOut,count);
|
if (Diag::ETHERNET) DIAG(F("Ethernet reply socket=%d, count=:%d\n"), socketOut,count);
|
||||||
for(;count>0;count--) clients[socketOut].write(outboundRing->read());
|
for(;count>0;count--) clients[socketOut].write(outboundRing->read());
|
||||||
clients[socketOut].flush(); //maybe
|
clients[socketOut].flush(); //maybe
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
// which libraray is involved.
|
// which libraray is involved.
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef LCD_Implementation_h
|
||||||
|
#define LCD_Implementation_h
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include "LCDDisplay.h"
|
#include "LCDDisplay.h"
|
||||||
@ -51,5 +53,4 @@ LCDDisplay * LCDDisplay::lcdDisplay=0;
|
|||||||
#define CONDITIONAL_LCD_START if (false) /* NO LCD CONFIG */
|
#define CONDITIONAL_LCD_START if (false) /* NO LCD CONFIG */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // LCD_Implementation_h
|
||||||
|
|
||||||
|
@ -76,6 +76,14 @@ The configuration file for DCC++ EX Command Station
|
|||||||
//
|
//
|
||||||
//#define WIFI_CONNECT_TIMEOUT 14000
|
//#define WIFI_CONNECT_TIMEOUT 14000
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// ENABLE_ETHERNET: Set to true if you have an Arduino Ethernet card (wired). This
|
||||||
|
// is not for Wifi. You will then need the Arduino Ethernet library as well
|
||||||
|
//
|
||||||
|
//#define ENABLE_ETHERNET true
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DEFINE STATIC IP ADDRESS *OR* COMMENT OUT TO USE DHCP
|
// DEFINE STATIC IP ADDRESS *OR* COMMENT OUT TO USE DHCP
|
||||||
|
Loading…
Reference in New Issue
Block a user