Skip to content

Commit

Permalink
Moved PIN defines to main.h. Added defines for PCB V3
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrGri committed Oct 31, 2023
1 parent fd6a837 commit 99cfcc8
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 15 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified Arduino/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions Arduino/Esp32/Main/LoadCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
94 changes: 93 additions & 1 deletion Arduino/Esp32/Main/Main.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#pragma once

#include <ADS1256.h>
//#include <ADS1256.h>

/********************************************************************/
/* 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
Expand All @@ -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

15 changes: 2 additions & 13 deletions Arduino/Esp32/Main/Main.ino
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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



/**********************************************************************************************/
Expand Down
Binary file modified Arduino/libs/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion Arduino/libs/ADS1255-ADS1256

0 comments on commit 99cfcc8

Please sign in to comment.