mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 10:06:13 +01:00
baseline calibration
This commit is contained in:
parent
9282d6a72f
commit
fe6fe09ac8
|
@ -297,7 +297,11 @@ void DCCWaveform::setAckBaseline() {
|
|||
if (isMainTrack) return;
|
||||
int baseline=motorDriver->getCurrentRaw();
|
||||
for (int i = 0; i < 32; i++)
|
||||
<<<<<<< Updated upstream
|
||||
baseline = max(baseline, motorDriver->getCurrentRaw());
|
||||
=======
|
||||
baseline=max(baseline, motorDriver->getCurrentRaw());
|
||||
>>>>>>> Stashed changes
|
||||
ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA);
|
||||
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"),
|
||||
baseline,motorDriver->raw2mA(baseline),
|
||||
|
@ -305,6 +309,32 @@ void DCCWaveform::setAckBaseline() {
|
|||
minAckPulseDuration, maxAckPulseDuration);
|
||||
}
|
||||
|
||||
/*
|
||||
void DCCWaveform::setAckBaseline() {
|
||||
if (isMainTrack) return;
|
||||
int baseline = motorDriver->getCurrentRaw();
|
||||
|
||||
int baselinemin = baseline;
|
||||
int baselinemax = baseline;
|
||||
int newSample = 0;
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
newSample = motorDriver->getCurrentRaw();
|
||||
baselinemax = max(baselinemax, newSample);
|
||||
baselinemin = min(baselinemin, newSample);
|
||||
}
|
||||
baseline = baselinemax;
|
||||
ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA);
|
||||
|
||||
if (Diag::ACK) DIAG(F("ACK min %d max %d"), baselinemin, baselinemax);
|
||||
|
||||
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"),
|
||||
baseline,motorDriver->raw2mA(baseline),
|
||||
ackThreshold,motorDriver->raw2mA(ackThreshold),
|
||||
minAckPulseDuration, maxAckPulseDuration);
|
||||
}
|
||||
*/
|
||||
|
||||
void DCCWaveform::setAckPending() {
|
||||
if (isMainTrack) return;
|
||||
ackMaxCurrent=0;
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
//
|
||||
// Arduino standard Motor Shield
|
||||
#define STANDARD_MOTOR_SHIELD F("STANDARD_MOTOR_SHIELD"), \
|
||||
new MotorDriver(3, 12, UNUSED_PIN, UNUSED_PIN, A0, 2.99, 2000, UNUSED_PIN), \
|
||||
new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN)
|
||||
new MotorDriver(3, 12, UNUSED_PIN, UNUSED_PIN, A0, 41.54, 5000, UNUSED_PIN), \
|
||||
new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 41.54, 5000, UNUSED_PIN)
|
||||
|
||||
// Pololu Motor Shield
|
||||
#define POLOLU_MOTOR_SHIELD F("POLOLU_MOTOR_SHIELD"), \
|
||||
|
|
|
@ -29,14 +29,13 @@
|
|||
|
||||
#include "LCDDisplay.h"
|
||||
|
||||
bool Diag::ACK=false;
|
||||
bool Diag::ACK=true;
|
||||
bool Diag::CMD=false;
|
||||
bool Diag::WIFI=false;
|
||||
bool Diag::WITHROTTLE=false;
|
||||
bool Diag::ETHERNET=false;
|
||||
bool Diag::LCN=false;
|
||||
|
||||
|
||||
void StringFormatter::diag( const FSH* input...) {
|
||||
if (!diagSerial) return;
|
||||
diagSerial->print(F("<* "));
|
||||
|
|
Loading…
Reference in New Issue
Block a user