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

Pololu on Mega seems OK

This commit is contained in:
Harald Barth 2020-07-10 01:03:47 +02:00
parent 0c9b2d962b
commit 9d9c6edc2f
3 changed files with 14 additions and 7 deletions

View File

@ -3,19 +3,23 @@
// This hardware configuration would normally be setup using a bunch of #ifdefs. // This hardware configuration would normally be setup using a bunch of #ifdefs.
const byte MAIN_POWER_PIN = 3; const byte MAIN_POWER_PIN = 4;
const byte MAIN_SIGNAL_PIN = 12; const byte MAIN_SIGNAL_PIN = 7;
const byte MAIN_SIGNAL_PIN_ALT = 0; // for hardware that flipflops signal pins const byte MAIN_SIGNAL_PIN_ALT = 0; // for hardware that flipflops signal pins
const byte MAIN_SENSE_PIN = A0; const byte MAIN_SENSE_PIN = A0;
const byte MAIN_BRAKE_PIN = 9; const byte MAIN_BRAKE_PIN = 9;
const float MAIN_SENSE_FACTOR=1.717; // analgRead(MAIN_SENSE_PIN) * MAIN_SENSE_FACTOR = milliamps
const byte PROG_POWER_PIN = 11; const int MAIN_MAX_MILLIAMPS=2000;
const byte PROG_SIGNAL_PIN = 13; const float MAIN_SENSE_FACTOR=18; // analgRead(MAIN_SENSE_PIN) * MAIN_SENSE_FACTOR = milliamps
const byte PROG_POWER_PIN = 2;
const byte PROG_SIGNAL_PIN = 8;
const byte PROG_SIGNAL_PIN_ALT = 0; // for hardware that flipflops signal pins const byte PROG_SIGNAL_PIN_ALT = 0; // for hardware that flipflops signal pins
const byte PROG_SENSE_PIN = A1; const byte PROG_SENSE_PIN = A1;
const byte PROG_BRAKE_PIN = 8; const byte PROG_BRAKE_PIN = 10;
const float PROG_SENSE_FACTOR=1.717; // analgRead(PROG_SENSE_PIN) * PROG_SENSE_FACTOR = milliamps
const int PROG_MAX_MILLIAMPS=250;
const float PROG_SENSE_FACTOR=18; // analgRead(PROG_SENSE_PIN) * PROG_SENSE_FACTOR = milliamps
// Allocations with memory implications..! // Allocations with memory implications..!
// Base system takes approx 900 bytes + 8 per loco. Turnouts, Sensors etc are dynamically created // Base system takes approx 900 bytes + 8 per loco. Turnouts, Sensors etc are dynamically created

View File

@ -73,6 +73,7 @@ POWERMODE DCCWaveform::getPowerMode() {
void DCCWaveform::setPowerMode(POWERMODE mode) { void DCCWaveform::setPowerMode(POWERMODE mode) {
powerMode = mode; powerMode = mode;
Hardware::setPower(isMainTrack, mode == POWERMODE::ON); Hardware::setPower(isMainTrack, mode == POWERMODE::ON);
Hardware::setBrake(isMainTrack, mode == POWERMODE::OFF);
if (mode == POWERMODE::ON) delay(200); if (mode == POWERMODE::ON) delay(200);
} }

View File

@ -15,11 +15,13 @@
void Hardware::init() { void Hardware::init() {
pinMode(MAIN_POWER_PIN, OUTPUT); pinMode(MAIN_POWER_PIN, OUTPUT);
pinMode(MAIN_BRAKE_PIN, OUTPUT);
pinMode(MAIN_SIGNAL_PIN, OUTPUT); pinMode(MAIN_SIGNAL_PIN, OUTPUT);
if (MAIN_SIGNAL_PIN_ALT) pinMode(MAIN_SIGNAL_PIN_ALT, OUTPUT); if (MAIN_SIGNAL_PIN_ALT) pinMode(MAIN_SIGNAL_PIN_ALT, OUTPUT);
pinMode(MAIN_SENSE_PIN, INPUT); pinMode(MAIN_SENSE_PIN, INPUT);
pinMode(PROG_POWER_PIN, OUTPUT); pinMode(PROG_POWER_PIN, OUTPUT);
pinMode(PROG_BRAKE_PIN, OUTPUT);
pinMode(PROG_SIGNAL_PIN, OUTPUT); pinMode(PROG_SIGNAL_PIN, OUTPUT);
if (PROG_SIGNAL_PIN_ALT) pinMode(PROG_SIGNAL_PIN_ALT, OUTPUT); if (PROG_SIGNAL_PIN_ALT) pinMode(PROG_SIGNAL_PIN_ALT, OUTPUT);
pinMode(PROG_SENSE_PIN, INPUT); pinMode(PROG_SENSE_PIN, INPUT);