1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 15:46:14 +01:00

Add files via upload

Useful edits to comments
This commit is contained in:
Barry Daniel 2024-09-25 11:59:41 +10:00 committed by GitHub
parent 7421851c53
commit df639f5c66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 11 deletions

View File

@ -16,8 +16,10 @@
* You should have received a copy of the GNU General Public License
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
*/
#define driverVer 303
#define driverVer 304
// v304 static oldb0; t(##[,%%];
// v303 zipped with CS 5.2.76 and uploaded to repo (with debug)
// v302 SEND=StringFormatter::send; remove Sp(); + 'q'; memcpy( .8) -> .7);
// v301 improved 'f','p'&'q' code and driver version calc. Correct bsNo calc. for 'a'
// v300 stripped & revised without expander functionality. Needs sensorCAM.h v300 AND CamParser.cpp
// v222 uses '@'for EXIORDD read. handles <NB $> and <NN $ ##>
@ -50,7 +52,6 @@
#ifndef IO_EX_EXSENSORCAM_H
#define IO_EX_EXSENSORCAM_H
#define SEND StringFormatter::send
#include "IODevice.h"
#include "I2CManager.h"
#include "DIAG.h"
@ -63,7 +64,6 @@
*/
class EXSensorCAM : public IODevice {
public:
static void create(VPIN vpin, int nPins, I2CAddress i2cAddress) {
if (checkNoOverlap(vpin, nPins, i2cAddress))
new EXSensorCAM(vpin, nPins, i2cAddress);
@ -82,7 +82,6 @@ class EXSensorCAM : public IODevice {
addDevice(this);
}
//*************************
uint8_t oldb0;
void _begin() {
uint8_t status;
// Initialise EX-SensorCAM device
@ -223,6 +222,7 @@ int ioESP32(uint8_t i2cAddr,uint8_t *rBuf,int inbytes,uint8_t *outBuff,int outby
//rBuf contains packet of up to 32 bytes usually with (ascii) cmd header in rBuf[0]
//sensorCmd command header byte from CAM (in rBuf[0]?)
int processIncomingPkt(uint8_t *rBuf,uint8_t sensorCmd) {
static uint8_t oldb0; //for debug only
int k;
int b;
char str[] = "11111111";
@ -231,7 +231,7 @@ int processIncomingPkt(uint8_t *rBuf,uint8_t sensorCmd) {
case '`': //response to request for digitalInputStates[] table '@'=>'`'
memcpy(_digitalInputStates, rBuf+1, digitalBytesNeeded);
if ( _digitalInputStates[0]!=oldb0) { oldb0=_digitalInputStates[0]; //debug
for (k=0;k<5;k++) {Serial.print(" ");Serial.print(_digitalInputStates[k],HEX);}
// for (k=0;k<5;k++) {Serial.print(" ");Serial.print(_digitalInputStates[k],HEX);}
}break;
case EXIORDY: //some commands give back acknowledgement only
@ -290,7 +290,7 @@ int processIncomingPkt(uint8_t *rBuf,uint8_t sensorCmd) {
case 't': //threshold etc. from t## //bad pkt if 't' FF's
if(rBuf[1]==0xFF) {Serial.println("<n bad CAM 't' packet: 74 FF n>");_savedCmd[2] +=1; return 0;}
SEND(&USB_SERIAL,F("<n (t[##[,%%]]) Threshold:%d sensor S00:-%d"),rBuf[1],min(rBuf[2]&0x7F,99));
SEND(&USB_SERIAL,F("<n (t[##[,%%%%]]) Threshold:%d sensor S00:-%d"),rBuf[1],min(rBuf[2]&0x7F,99));
if(rBuf[2]>127) Serial.print("##* ");
else{
if(rBuf[2]>rBuf[1]) Serial.print("-?* ");

View File

@ -333,6 +333,20 @@ The configuration file for DCC-EX Command Station
// to the sabertooth controller _as_well_. Default: Undefined.
//
//#define SABERTOOTH 1
//
/////////////////////////////////////////////////////////////////////////////////////
//
// SENSORCAM
// ESP32-CAM based video sensors require #define to use appropriate base vpin number.
#define SENSORCAM_VPIN 700
// For shortcut to vPin number, define CAM for ex-rail use e.g. AT(CAM 012) for S12 etc.
#define CAM SENSORCAM_VPIN+
//#define SENSORCAM2_VPIN 600 //define other CAM's if installed.
//#define CAM2 SENSORCAM2_VPIN+ //for EX-RAIL commands e.g. IFLT(CAM2 020,1)
//
// For smoother power-up, define a STARTUP_DELAY to allow CAM to initialise ref images
#define STARTUP_DELAY 5000 // up to 20sec. CS delay
/////////////////////////////////////////////////////////////////////////////////////

View File

@ -351,12 +351,11 @@ EXIOExpander::create(800, 18, 0x65); // NanoEXIOExpander::create(820, 18, 0x75)
// #define SENSORCAM_VPIN0 #00 in config.h if not using 700.
// Number of VPINs=pin count (must not exceed 80)
// I2C address=an available I2C address (default 0x11)
// #define ESP32CAP 0x13 in config.h to raise allowable ESP32 range of addresses
// Note that the I2C address (0x11) is the default in the sensorCAM code
//
// EXSensorCAM::create(700, 80, 0x11);
EXSensorCAM::create(700, 80, 0x11); //preference is now to use HAL(700 80 0x11) in myAutomation.h
EXSensorCAM::create(700, 80, 0x11);
//EXSensorCAM::create(600, 80, 0x12); //alternate or second CAM device address creation
//preference is now to use HAL(EXSensorCAM 700 80 0x11) in myAutomation.h rather than :create
}
#endif