1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-02 12:25:03 +01:00

take less progmem for messages

This commit is contained in:
Harald Barth 2021-08-01 12:45:29 +02:00
parent 6d7c1925b0
commit 55b7091d5a

View File

@ -46,10 +46,8 @@ void DCCWaveform::begin(MotorDriver * mainDriver, MotorDriver * progDriver) {
&& (mainDriver->getFaultPin() != UNUSED_PIN)); && (mainDriver->getFaultPin() != UNUSED_PIN));
// Only use PWM if both pins are PWM capable. Otherwise JOIN does not work // Only use PWM if both pins are PWM capable. Otherwise JOIN does not work
MotorDriver::usePWM= mainDriver->isPWMCapable() && progDriver->isPWMCapable(); MotorDriver::usePWM= mainDriver->isPWMCapable() && progDriver->isPWMCapable();
if (MotorDriver::usePWM) DIAG(F("Signal pin config: %S accuracy waveform"),
DIAG(F("Signal pin config: high accuracy waveform")); MotorDriver::usePWM ? F("high") : F("normal") );
else
DIAG(F("Signal pin config: normal accuracy waveform"));
DCCTimer::begin(DCCWaveform::interruptHandler); DCCTimer::begin(DCCWaveform::interruptHandler);
} }
@ -126,6 +124,8 @@ void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
if (!isMainTrack && !ackManagerActive && !progTrackSyncMain && !progTrackBoosted) if (!isMainTrack && !ackManagerActive && !progTrackSyncMain && !progTrackBoosted)
tripValue=progTripValue; tripValue=progTripValue;
// Trackname for diag messages later
const FSH*trackname = isMainTrack ? F("MAIN") : F("PROG");
switch (powerMode) { switch (powerMode) {
case POWERMODE::OFF: case POWERMODE::OFF:
sampleDelay = POWER_SAMPLE_OFF_WAIT; sampleDelay = POWER_SAMPLE_OFF_WAIT;
@ -143,9 +143,9 @@ void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
} }
// Write this after the fact as we want to turn on as fast as possible // Write this after the fact as we want to turn on as fast as possible
// because we don't know which output actually triggered the fault pin // because we don't know which output actually triggered the fault pin
DIAG(F("*** COMMON FAULT PIN ACTIVE - TOGGLED POWER on %S ***"), isMainTrack ? F("MAIN") : F("PROG")); DIAG(F("COMMON FAULT PIN ACTIVE - TOGGLED POWER on %S"), trackname);
} else { } else {
DIAG(F("*** %S FAULT PIN ACTIVE - OVERLOAD ***"), isMainTrack ? F("MAIN") : F("PROG")); DIAG(F("%S FAULT PIN ACTIVE - OVERLOAD"), trackname);
if (lastCurrent < tripValue) { if (lastCurrent < tripValue) {
lastCurrent = tripValue; // exaggerate lastCurrent = tripValue; // exaggerate
} }
@ -163,7 +163,7 @@ void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
unsigned int maxmA=motorDriver->raw2mA(tripValue); unsigned int maxmA=motorDriver->raw2mA(tripValue);
power_good_counter=0; power_good_counter=0;
sampleDelay = power_sample_overload_wait; sampleDelay = power_sample_overload_wait;
DIAG(F("*** %S TRACK POWER OVERLOAD current=%d max=%d offtime=%d ***"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA, sampleDelay); DIAG(F("%S TRACK POWER OVERLOAD current=%d max=%d offtime=%d"), trackname, mA, maxmA, sampleDelay);
if (power_sample_overload_wait >= 10000) if (power_sample_overload_wait >= 10000)
power_sample_overload_wait = 10000; power_sample_overload_wait = 10000;
else else
@ -175,7 +175,7 @@ void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
setPowerMode(POWERMODE::ON); setPowerMode(POWERMODE::ON);
sampleDelay = POWER_SAMPLE_ON_WAIT; sampleDelay = POWER_SAMPLE_ON_WAIT;
// Debug code.... // Debug code....
DIAG(F("*** %S TRACK POWER RESET delay=%d ***"), isMainTrack ? F("MAIN") : F("PROG"), sampleDelay); DIAG(F("%S TRACK POWER RESET delay=%d"), trackname, sampleDelay);
break; break;
default: default:
sampleDelay = 999; // cant get here..meaningless statement to avoid compiler warning. sampleDelay = 999; // cant get here..meaningless statement to avoid compiler warning.