diff --git a/.DS_Store b/.DS_Store index 9970dffc..8727653d 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Arduino/.DS_Store b/Arduino/.DS_Store index 79f50b9d..61215ba2 100644 Binary files a/Arduino/.DS_Store and b/Arduino/.DS_Store differ diff --git a/Arduino/Esp32/Main/LoadCell.cpp b/Arduino/Esp32/Main/LoadCell.cpp index 31170cd6..6f7a823c 100644 --- a/Arduino/Esp32/Main/LoadCell.cpp +++ b/Arduino/Esp32/Main/LoadCell.cpp @@ -54,6 +54,7 @@ LoadCell_ADS1256::LoadCell_ADS1256(uint8_t channel0, uint8_t channel1) : _zeroPoint(0.0), _varianceEstimate(DEFAULT_VARIANCE_ESTIMATE) { ADC().setChannel(channel0,channel1); // Set the MUX for differential between ch0 and ch1 + //ADC().setChannel(channel1, channel0); // Set the MUX for differential between ch0 and ch1 } float LoadCell_ADS1256::getReadingKg() const { diff --git a/Arduino/Esp32/Main/Main.h b/Arduino/Esp32/Main/Main.h index 5ff75da0..41adf937 100644 --- a/Arduino/Esp32/Main/Main.h +++ b/Arduino/Esp32/Main/Main.h @@ -1,6 +1,21 @@ #pragma once -#include +//#include + +/********************************************************************/ +/* Select the PCB */ +/********************************************************************/ +//#define PCB_VERSION 1 // V1 for regular ESP32 +//#define PCB_VERSION 2 // V1 for ESP32 S2 mini +#define PCB_VERSION 3 // V3 for regular ESP32 + + + + + +/********************************************************************/ +/* Other defines */ +/********************************************************************/ // target cycle time for pedal update task, to get constant cycle times, required for FIR filtering #define DAP_MICROSECONDS_PER_SECOND 1000000 @@ -25,3 +40,80 @@ #define ADC_SAMPLE_RATE ADS1256_DRATE_1000SPS #define PUT_TARGET_CYCLE_TIME_IN_US DAP_MICROSECONDS_PER_SECOND / 1000 + + + + +/********************************************************************/ +/* PIN defines */ +/********************************************************************/ +// initial version of dev PCB for regular ESP32 +#if PCB_VERSION == 1 + // ADC defines + #define PIN_DRDY 17// 17 --> DRDY + #define PIN_RST 16 // X --> X + #define PIN_SCK 18 // 18 -->SCLK + #define PIN_MISO 19 // 19 --> DOUT + #define PIN_MOSI 23 // 23 --> DIN + #define PIN_CS 5 // 5 --> CS + + // stepper pins + #define dirPinStepper 0 + #define stepPinStepper 4 + + // endstop pins + #define minPin 34 + #define maxPin 35 + + // level shifter not present on this PCB design + #define SENSORLESS_HOMING false +#endif + + +// initial version of dev PCB for ESP32 S2 mini +#if PCB_VERSION == 2 + // ADC defines + #define PIN_DRDY 37// 37 --> DRDY + #define PIN_RST 16 // X --> X + #define PIN_SCK 18 // 18 -->SCLK + #define PIN_MISO 35 // 35 --> DOUT + #define PIN_MOSI 33 // 33 --> DIN + #define PIN_CS 39 // 39 --> CS + + // stepper pins + #define dirPinStepper 8 + #define stepPinStepper 9 + + // endstop pins + #define minPin 11 + #define maxPin 10 + + // level shifter not present on this PCB design + #define SENSORLESS_HOMING false +#endif + + + +// V3 version of dev PCB for regular ESP32 +#if PCB_VERSION == 3 + // ADC defines + #define PIN_DRDY 19// 19 --> DRDY + #define PIN_RST 16 // X --> X + #define PIN_SCK 16 // 16 -->SCLK + #define PIN_MISO 18 // 18 --> DOUT + #define PIN_MOSI 17 // 17 --> DIN + #define PIN_CS 21 // 21 --> CS + + // stepper pins + #define dirPinStepper 22 + #define stepPinStepper 23 + + // endstop pins + #define minPin 11 + #define maxPin 10 + + // level shifter is present on this PCB design + #define SENSORLESS_HOMING true + +#endif + diff --git a/Arduino/Esp32/Main/Main.ino b/Arduino/Esp32/Main/Main.ino index a2623fc7..8822c3c3 100644 --- a/Arduino/Esp32/Main/Main.ino +++ b/Arduino/Esp32/Main/Main.ino @@ -1,7 +1,7 @@ #define ESTIMATE_LOADCELL_VARIANCE #define ISV_COMMUNICATION //#define PRINT_SERVO_STATES -#define SENSORLESS_HOMING false//true + bool resetServoEncoder = true; bool isv57LifeSignal_b = false; @@ -112,18 +112,7 @@ bool resetPedalPosition = false; /* */ /**********************************************************************************************/ -// Wiring connections -#if CONFIG_IDF_TARGET_ESP32S2 - #define minPin 11 - #define maxPin 10 - #define dirPinStepper 8 - #define stepPinStepper 9 // step pin must be pin 9 -#elif CONFIG_IDF_TARGET_ESP32 - #define minPin 34 - #define maxPin 35 - #define dirPinStepper 0//8 - #define stepPinStepper 4//9 -#endif + /**********************************************************************************************/ diff --git a/Arduino/libs/.DS_Store b/Arduino/libs/.DS_Store index 89f7490b..ef284b39 100644 Binary files a/Arduino/libs/.DS_Store and b/Arduino/libs/.DS_Store differ diff --git a/Arduino/libs/ADS1255-ADS1256 b/Arduino/libs/ADS1255-ADS1256 index 80ca04d0..11375eee 160000 --- a/Arduino/libs/ADS1255-ADS1256 +++ b/Arduino/libs/ADS1255-ADS1256 @@ -1 +1 @@ -Subproject commit 80ca04d0587f9a7ad98eb2af6169fee1fb2cace1 +Subproject commit 11375eee4b39f54539a95714b7c67b8d510528b8