Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Development (#17)
Browse files Browse the repository at this point in the history
* Frightrisk current mod (#12)

* deleted files from old folder

* major changes to  current monitor and added motor boards and configuration parameters.

This version will change current reading to milliamps instead of pin readings. We will keep the pin readings because that information is valuable. Ultimately, we will need to upgrade JMRI if we change the place in the code where <c> reports back the pin reading to give a percentage of  max current.

* Add functions functions to return current, triggerMilliamps and maxMilliamps. Change the serial output of the <c> command. This will require changes to JMRI

* minor correction of typos in SerialCommand.cpp

* Add trigger pin feature for testing with instruments to config.h. Added comments and fixed typos in other files.

* Finish current monitor changes. Add members to classes and parameters to functions to determine if a track is service (prog) or not, limit current to 250mA on prog, and created hook for enhanced current related reporting to front ends like JMRI

* add more code to the trigger pin function used for testing with a scope or packet analyzer

* Add SHOW_CONFIG_PIN_DETAIL define constant for the analog pin used to tie to ground to display detailed configuration information at bootup

* add 'EX' to all references to DCC++

* Add F( PROGMEM macro to strings using serial.print. changed int declaration for pins from int to uint8_t

* Fix error in matching uint_8 type to the number of arduino pins

* Shorten status string. Shortened status string and added space between <i and the first character of the status information that followed

* Reduce buffer in CommManager. CommManager::Printf() had a 256 byte buffer. This takes up a lot of SRAM in the Uno. Reduced size to 128.

* Shortened Motor Board Names. Motor board names are used in strings. We need to keep them as short as possible

* Removed added space between i and DCC++ in status messages. JMRI expects the return from the <s> command to have DCC come right after the i

* Add serial monitor speed of 115200 baud to platformio.ini

* Remove folder added by mistake

* Rework packets for read/write CVs. Reduce ACK_SAMPLE_COUNT, simplify current detect and make it use milliamps in instead of pin reading. Use counter to test for X number of readings over the ACK current threshold instead of smoothing. Move final idle packet to load only after an ACK. Break out of ack sample count loop as soon as we have an ACK.

* Change Pololu board trip current to 2500 milliAmps. Some boards can go to 3000 mA. Set accordingly for your board

* Work on current monitoring. Factor base current code into a function. Add last tripped timer to only attempt to turn on power after a short once a timer has expired.

* Change default trip current (ACK_SAMPLE_THRESHOLD) to 55mA. Remove TODOS

* Modify ack detection

* Shorten names for LMD18200 boards

* Add R24 Networking feature

* change comment line to be RF not R

* Fix defines for alternate I2C monitor

* Add SPI and Radio ti SerialCommand::Init

* add missing parenthesis in radio.begin()

* Change current monitoring code and add 'C' command

* Change current sens and add test 'C' command

* Add C command to SerialCommand parser

* disable LCD in default build

* Update PacketRegister.cpp

change registerlist from unsigned int to int

* Update PacketRegister.cpp

Remove redefined registerBaseCurrent routine

* Update Config.h

fix typo

* Update CurrentMonitor.cpp

drop unnecessary current variable

* Update CurrentMonitor.cpp

remove unnecessary maxcurrent variable

* Update CurrentMonitor.h

get rid of maxcurrent variable from motorboard class

* Update CurrentMonitor.cpp

Remove unnecessary variable tripcurrent

* Update CurrentMonitor.h

get rid of unnecessary tripcurrent variable

* Update DCCppEX.h

structure "if defined" constructs to be standard

* Update DCCppEX.ino

Fix "if defined" to be standard

* Update PacketRegister.cpp

remove an extra space for formatting

* fix "if defined" statements and new packets
  • Loading branch information
FrightRisk authored Jul 7, 2020
1 parent b458b93 commit 1a7e206
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DCCpp_EX/DCCppEX/DCCppEX.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Part of DCC++ EX BASE STATION for the Arduino
// RELEASE VERSION
/////////////////////////////////////////////////////////////////////////////////////

#define VERSION "2.1.2"
#define VERSION "2.1.3"

/////////////////////////////////////////////////////////////////////////////////////
// AUTO-SELECT ARDUINO BOARD
Expand Down
12 changes: 7 additions & 5 deletions DCCpp_EX/DCCppEX/PacketRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ void RegisterList::readCV(const char *s) volatile{

loadPacket(0,resetPacket,2,3); // NMRA recommends starting with 3 reset packets
loadPacket(0,bRead,3,5); // NMRA recommends 5 verify packets
loadPacket(0,bRead,3,1); // Line for D&H decoders
loadPacket(0,idlePacket,2,6); // NMRA recommends 6 idle or reset packets for decoder recovery time

for(int j=0;j<ACK_SAMPLE_COUNT;j++){
Expand Down Expand Up @@ -270,7 +271,8 @@ void RegisterList::readCV(const char *s) volatile{

loadPacket(0,resetPacket,2,3); // NMRA recommends starting with 3 reset packets
loadPacket(0,bRead,3,5); // NMRA recommends 5 verify packets
loadPacket(0,idlePacket,2,6); // NMRA recommends 6 idle or reset packets for decoder recovery time
loadPacket(0,bRead,3,1); // Line for D&H decoders
loadPacket(0,idlePacket,2,6); // NMRA recommends 6 idle or reset packets for decoder recovery time

for(int j=0;j<ACK_SAMPLE_COUNT;j++){
current=analogRead(CURRENT_MONITOR_PIN_PROG) - base;
Expand Down Expand Up @@ -314,10 +316,10 @@ void RegisterList::writeCVByte(const char *s) volatile{
bWrite[1]=lowByte(cv);
bWrite[2]=bValue;

loadPacket(0,resetPacket,2,3); // NMRA recommends starting with 3 reset packets
loadPacket(0,bWrite,3,5); // NMRA recommends 5 write packets
loadPacket(0,resetPacket,2,1); // NMRA recommends starting with 3 reset packets
loadPacket(0,bWrite,3,4); // NMRA recommends 5 write packets
//loadPacket(0,bWrite,2,6); // NMRA recommends 6 write or reset packets for decoder recovery time
loadPacket(0,idlePacket,2,6);
loadPacket(0,idlePacket,2,10);

base=0;
current=0;
Expand All @@ -331,7 +333,7 @@ void RegisterList::writeCVByte(const char *s) volatile{
// TODO NMRA says reset, write then reset IF we got a verify
loadPacket(0,resetPacket,2,3); // NMRA recommends starting with 3 reset packets
loadPacket(0,bWrite,3,5); // NMRA recommends 5 verify packets
loadPacket(0,bWrite,3,6); // NMRA recommends 6 write or reset packets for decoder recovery time
loadPacket(0,bWrite,3,1); // NMRA recommends 6 write or reset packets for decoder recovery time

for(int j=0;j<ACK_SAMPLE_COUNT;j++){
current=analogRead(CURRENT_MONITOR_PIN_PROG) - base;
Expand Down

0 comments on commit 1a7e206

Please sign in to comment.