mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
OOps current detect wrong
This commit is contained in:
parent
505a8346d8
commit
53769205e4
|
@ -3,8 +3,8 @@
|
|||
#include "DCCWaveform.h"
|
||||
#include "DIAG.h"
|
||||
|
||||
DCCWaveform DCCWaveform::mainTrack(PREAMBLE_BITS_MAIN, true, MAIN_MAX_MILLIAMPS* MAIN_SENSE_FACTOR);
|
||||
DCCWaveform DCCWaveform::progTrack(PREAMBLE_BITS_PROG, false, 250 * PROG_SENSE_FACTOR);
|
||||
DCCWaveform DCCWaveform::mainTrack(PREAMBLE_BITS_MAIN, true, (int)(MAIN_MAX_MILLIAMPS / MAIN_SENSE_FACTOR));
|
||||
DCCWaveform DCCWaveform::progTrack(PREAMBLE_BITS_PROG, false, (int)(PROG_MAX_MILLIAMPS / PROG_SENSE_FACTOR));
|
||||
|
||||
const int ACK_MIN_PULSE_RAW=65 / PROG_SENSE_FACTOR;
|
||||
|
||||
|
@ -94,8 +94,8 @@ void DCCWaveform::checkPowerOverload() {
|
|||
if (lastCurrent <= rawCurrentTripValue) sampleDelay = POWER_SAMPLE_ON_WAIT;
|
||||
else {
|
||||
setPowerMode(POWERMODE::OVERLOAD);
|
||||
int mA=Hardware::getCurrentMilliamps(isMainTrack,lastCurrent);
|
||||
int maxmA=Hardware::getCurrentMilliamps(isMainTrack,rawCurrentTripValue);
|
||||
unsigned int mA=Hardware::getCurrentMilliamps(isMainTrack,lastCurrent);
|
||||
unsigned int maxmA=Hardware::getCurrentMilliamps(isMainTrack,rawCurrentTripValue);
|
||||
DIAG(F("\n*** %S TRACK POWER OVERLOAD current=%d max=%d ***\n"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA);
|
||||
sampleDelay = POWER_SAMPLE_OVERLOAD_WAIT;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ int Hardware::getCurrentRaw(bool isMainTrack) {
|
|||
|
||||
}
|
||||
|
||||
int Hardware::getCurrentMilliamps(bool isMainTrack, int raw) {
|
||||
unsigned int Hardware::getCurrentMilliamps(bool isMainTrack, int raw) {
|
||||
return (int)(raw * (isMainTrack ? MAIN_SENSE_FACTOR : PROG_SENSE_FACTOR));
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class Hardware {
|
|||
static void init();
|
||||
static void setPower(bool isMainTrack, bool on);
|
||||
static void setSignal(bool isMainTrack, bool high);
|
||||
static int getCurrentMilliamps(bool isMainTrack, int rawValue);
|
||||
static unsigned int getCurrentMilliamps(bool isMainTrack, int rawValue);
|
||||
static int getCurrentRaw(bool isMainTrack);
|
||||
static void setBrake(bool isMainTrack, bool on);
|
||||
static void setCallback(int duration, void (*isr)());
|
||||
|
|
Loading…
Reference in New Issue
Block a user