mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
show current from main on LDC every 2 sec
This commit is contained in:
parent
fb97ba11de
commit
f7861e5103
|
@ -34,6 +34,8 @@ int DCCWaveform::progTripValue=0;
|
|||
volatile uint8_t DCCWaveform::numAckGaps=0;
|
||||
volatile uint8_t DCCWaveform::numAckSamples=0;
|
||||
uint8_t DCCWaveform::trailingEdgeCounter=0;
|
||||
static unsigned long lastLCDCurrentDisplay=0;
|
||||
#define LCD_SAMPLE_PERIOD 2000 // milliseconds
|
||||
|
||||
void DCCWaveform::begin(MotorDriver * mainDriver, MotorDriver * progDriver) {
|
||||
mainTrack.motorDriver=mainDriver;
|
||||
|
@ -119,8 +121,9 @@ void DCCWaveform::setPowerMode(POWERMODE mode) {
|
|||
|
||||
|
||||
void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
|
||||
if (millis() - lastSampleTaken < sampleDelay) return;
|
||||
lastSampleTaken = millis();
|
||||
unsigned long now = millis();
|
||||
if (now - lastSampleTaken < sampleDelay) return;
|
||||
lastSampleTaken = now;
|
||||
int tripValue= motorDriver->getRawCurrentTripValue();
|
||||
if (!isMainTrack && !ackManagerActive && !progTrackSyncMain && !progTrackBoosted)
|
||||
tripValue=progTripValue;
|
||||
|
@ -181,6 +184,10 @@ void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
|
|||
default:
|
||||
sampleDelay = 999; // cant get here..meaningless statement to avoid compiler warning.
|
||||
}
|
||||
if (isMainTrack && now - lastLCDCurrentDisplay > LCD_SAMPLE_PERIOD) {
|
||||
lastLCDCurrentDisplay=now;
|
||||
LCD(2,F("I= %dmA"), mainTrack.getCurrentmA());
|
||||
}
|
||||
}
|
||||
// For each state of the wave nextState=stateTransform[currentState]
|
||||
const WAVE_STATE DCCWaveform::stateTransform[]={
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define GITHUB_SHA "ee5db61"
|
||||
#define GITHUB_SHA "LDC-show-current 2021114-20:14"
|
||||
|
|
|
@ -50,12 +50,13 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
|
|||
va_list args;
|
||||
|
||||
// Issue the LCD as a diag first
|
||||
send(diagSerial,F("<* LCD%d:"),row);
|
||||
va_start(args, input);
|
||||
send2(diagSerial,input,args);
|
||||
send(diagSerial,F(" *>\n"));
|
||||
|
||||
if (!LCDDisplay::lcdDisplay) return;
|
||||
if (!LCDDisplay::lcdDisplay) {
|
||||
send(diagSerial,F("<* LCD%d:"),row);
|
||||
va_start(args, input);
|
||||
send2(diagSerial,input,args);
|
||||
send(diagSerial,F(" *>\n"));
|
||||
return;
|
||||
}
|
||||
LCDDisplay::lcdDisplay->setRow(row);
|
||||
va_start(args, input);
|
||||
send2(LCDDisplay::lcdDisplay,input,args);
|
||||
|
|
Loading…
Reference in New Issue
Block a user