mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-19 23:46:02 +01:00
4.2.19 sensorOffset bugfix
This commit is contained in:
parent
ca4592dc3e
commit
f0c1ea958c
@ -90,9 +90,8 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i
|
|||||||
else brakePin=UNUSED_PIN;
|
else brakePin=UNUSED_PIN;
|
||||||
|
|
||||||
currentPin=current_pin;
|
currentPin=current_pin;
|
||||||
if (currentPin!=UNUSED_PIN) {
|
if (currentPin!=UNUSED_PIN) ADCee::init(currentPin);
|
||||||
senseOffset = ADCee::init(currentPin);
|
senseOffset=0; // value can not be obtained until waveform is activated
|
||||||
}
|
|
||||||
|
|
||||||
faultPin=fault_pin;
|
faultPin=fault_pin;
|
||||||
if (faultPin != UNUSED_PIN) {
|
if (faultPin != UNUSED_PIN) {
|
||||||
@ -121,8 +120,8 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i
|
|||||||
if (currentPin==UNUSED_PIN)
|
if (currentPin==UNUSED_PIN)
|
||||||
DIAG(F("** WARNING ** No current or short detection"));
|
DIAG(F("** WARNING ** No current or short detection"));
|
||||||
else {
|
else {
|
||||||
DIAG(F("CurrentPin=A%d, Offset=%d, TripValue=%d"),
|
DIAG(F("CurrentPin=A%d, TripValue=%d"),
|
||||||
currentPin-A0, senseOffset,rawCurrentTripValue);
|
currentPin-A0, rawCurrentTripValue);
|
||||||
|
|
||||||
// self testing diagnostic for the non-float converters... may be removed when happy
|
// self testing diagnostic for the non-float converters... may be removed when happy
|
||||||
// DIAG(F("senseFactorInternal=%d raw2mA(1000)=%d mA2Raw(1000)=%d"),
|
// DIAG(F("senseFactorInternal=%d raw2mA(1000)=%d mA2Raw(1000)=%d"),
|
||||||
@ -144,6 +143,12 @@ bool MotorDriver::isPWMCapable() {
|
|||||||
void MotorDriver::setPower(POWERMODE mode) {
|
void MotorDriver::setPower(POWERMODE mode) {
|
||||||
bool on=mode==POWERMODE::ON;
|
bool on=mode==POWERMODE::ON;
|
||||||
if (on) {
|
if (on) {
|
||||||
|
// when switching a track On, we need to check the crrentOffset with the pin OFF
|
||||||
|
if (powerMode==POWERMODE::OFF && currentPin!=UNUSED_PIN) {
|
||||||
|
senseOffset = ADCee::read(currentPin);
|
||||||
|
DIAG(F("CurrentPin A%d sensOffset=%d"),currentPin-A0,senseOffset);
|
||||||
|
}
|
||||||
|
|
||||||
IODevice::write(powerPin,invertPower ? LOW : HIGH);
|
IODevice::write(powerPin,invertPower ? LOW : HIGH);
|
||||||
if (isProgTrack)
|
if (isProgTrack)
|
||||||
DCCWaveform::progTrack.clearResets();
|
DCCWaveform::progTrack.clearResets();
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "4.2.18"
|
#define VERSION "4.2.19"
|
||||||
|
// 4.2.19 - Bugfix for analog reading of track current sensor offeset.
|
||||||
// 4.2.18 - I2C Multiplexer support through Extended Addresses,
|
// 4.2.18 - I2C Multiplexer support through Extended Addresses,
|
||||||
// added for Wire, 4209 and AVR I2C drivers.
|
// added for Wire, 4209 and AVR I2C drivers.
|
||||||
// - I2C retries when an operation fails.
|
// - I2C retries when an operation fails.
|
||||||
|
Loading…
Reference in New Issue
Block a user