diff --git a/platformio.ini b/platformio.ini index 9d5a535..cb646ab 100644 --- a/platformio.ini +++ b/platformio.ini @@ -52,22 +52,23 @@ build_flags = -D BUTTON_PIN=0 ; User button ; Define ESP32 connections to stepper motor driver (Trinamic TMC2209) and other settings - -D STEP_PIN=GPIO_NUM_16 ; Step pin - -D DIR_PIN=GPIO_NUM_18 ; Direction pin - -D DIAG_PIN=GPIO_NUM_23 ; For StallGuard, High if detect error - -D STBY_PIN=GPIO_NUM_19 ; Pull high to disable TMC2209 - -D TXD1=GPIO_NUM_22 ; For Serial1 - -D RXD1=GPIO_NUM_21 ; For Serial1 - -D R_SENSE=0.12f ; Sense resistor, double check the board's sense resistor value - -D DRIVER_ADDR=0b00 ; 0b00 is slave, since there're no other TMC stepper motor drivers + -D STEP_PIN=GPIO_NUM_16 ; Step pin + -D DIR_PIN=GPIO_NUM_18 ; Direction pin + -D DIAG_PIN=GPIO_NUM_23 ; For StallGuard, High if detect error + -D STBY_PIN=GPIO_NUM_19 ; Pull high to disable TMC2209 + -D TXD1=GPIO_NUM_22 ; For Serial1 + -D RXD1=GPIO_NUM_21 ; For Serial1 + -D R_SENSE=0.12f ; Sense resistor, double check the board's sense resistor value + -D DRIVER_ADDR=0b00 ; 0b00 is slave, since there're no other TMC stepper motor drivers ; Define ESP32 connection to rotary encoder (AS5600) - -D SCL_PIN=GPIO_NUM_27 ; SPI clock pin - -D SDA_PIN=GPIO_NUM_14 ; SPI data pin + -D SCL_PIN=GPIO_NUM_27 ; SPI clock pin + -D SDA_PIN=GPIO_NUM_14 ; SPI data pin + + !python ./src/scripts/git_revision.py extra_scripts = pre:./src/frontend/assembly.py pre:./src/scripts/modify_fastaccelstepper.py - pre:./src/scripts/git_revision.py ; board_build.partitions = default_8MB.csv \ No newline at end of file diff --git a/src/scripts/git_revision.py b/src/scripts/git_revision.py index eaef6a3..4c5de04 100644 --- a/src/scripts/git_revision.py +++ b/src/scripts/git_revision.py @@ -5,18 +5,4 @@ .strip() .decode("utf-8")[:7] ) - -def modify_system_task_h(): - result = "" - with open("./src/system_task.h", 'r') as file: - for line in file: - if "String firmware_ =" in line: - result += f" String firmware_ = \"{revision}\";\n" - else: - result += line - - with open("./src/system_task.h", 'w') as output: - output.write(result) - - -modify_system_task_h() \ No newline at end of file +print("'-D GIT_REV=\"%s\"'" % revision) \ No newline at end of file diff --git a/src/system_task.h b/src/system_task.h index d5a4075..6d8f242 100644 --- a/src/system_task.h +++ b/src/system_task.h @@ -24,7 +24,7 @@ class SystemTask: public Task { String serial_ = ""; // String manufacturer_ = ""; // String model_ = ""; - String firmware_ = "d0e7373"; + String firmware_ = GIT_REV; int system_wake_time_ = SYSTEM_WAKE_DURATION; // ms int system_sleep_time_ = SYSTEM_SLEEP_DURTION * 1000; // us