Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move firmware and continue removing vestiges of Arduino IDE support #245

Merged
merged 5 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/pio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,42 @@ jobs:
# # Run regardless of other build step failures, as long as setup steps completed
# if: always() && steps.pio_install.outcome == 'success'
# run: |
# pio run -d ./arduino/splitflap \
# pio run \
# -e uno-shift-register \

# - name: Build Firmware (uno-direct)
# # Run regardless of other build step failures, as long as setup steps completed
# if: always() && steps.pio_install.outcome == 'success'
# run: |
# pio run -d ./arduino/splitflap \
# pio run \
# -e uno-direct \

- name: Build Firmware (esp32)
- name: Build Firmware (esp32CustomAdvanced)
# Run regardless of other build step failures, as long as setup steps completed
if: always() && steps.pio_install.outcome == 'success'
run: |
pio run -d ./arduino/splitflap \
-e esp32 \
pio run \
-e esp32CustomAdvanced

- name: Build Firmware (chainlink)
# Run regardless of other build step failures, as long as setup steps completed
if: always() && steps.pio_install.outcome == 'success'
run: |
pio run -d ./arduino/splitflap \
pio run \
-e chainlink

- name: Build Firmware (chainlinkBase)
# Run regardless of other build step failures, as long as setup steps completed
if: always() && steps.pio_install.outcome == 'success'
run: |
pio run -d ./arduino/splitflap \
pio run \
-e chainlinkBase

# Temporarily disabled due to proto issue
# - name: Build Firmware (chainlinkDriverTester)
# # Run regardless of other build step failures, as long as setup steps completed
# if: always() && steps.pio_install.outcome == 'success'
# run: |
# cp arduino/splitflap/esp32/tester/secrets.h.example arduino/splitflap/esp32/tester/secrets.h &&
# pio run -d ./arduino/splitflap \
# cp firmware/esp32/tester/secrets.h.example firmware/esp32/tester/secrets.h &&
# pio run \
# -e chainlinkDriverTester
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ sensor.xml

# Arduino compiled output
*.hex

.pio
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ an informed decision about which revision(s) to use.

## Code
### Firmware
The driver firmware is written using PlatformIO with the Arduino framework and is available at [`arduino/splitflap/Splitflap/Splitflap.ino`](arduino/splitflap/Splitflap/Splitflap.ino).
The driver firmware is written using PlatformIO with the Arduino framework and is available at [`firmware/`](firmware/).

The firmware implements a closed-loop controller that accepts letters as input over USB serial and drives the stepper motors using a precomputed acceleration ramp for smooth control. The firmware automatically calibrates the spool position at startup, using the hall-effect magnetic sensor, and will automatically recalibrate itself if it ever detects that the spool position has gotten out of sync. If a commanded rotation is expected to bring the spool past the "home" position, it will confirm that the sensor is triggered neither too early nor too late; otherwise it will search for the "home" position to get in sync before continuing to the desired letter.

Expand Down
67 changes: 0 additions & 67 deletions arduino/splitflap/.travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions arduino/splitflap/MOVED.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
As of 2024-10-06, the firmware code that used to live in this directory has been moved to the "firmware" directory at the root of the repo.

In VS Code, you'll want to re-open this project by using "Open Folder" and selecting the entire "splitflap" repository folder.
If you run into any issues, please reach out in the discord community (https://discord.com/invite/wgehm3PcrC) for help.
1 change: 0 additions & 1 deletion arduino/splitflap/.gitignore → firmware/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <FastLED.h>

#include "Adafruit_MCP23017.h"
#include "src/Adafruit_INA219.h"
#include "Adafruit_INA219.h"

#include "../splitflap/serial_task.h"
#include "../core/splitflap_task.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool Configuration::saveToDisk() {
}
File f = FFat.open(CONFIG_PATH, FILE_WRITE);
if (!f) {
log("Failed to read config file");
log("Failed to open config file");
return false;
}
size_t written = f.write(buffer_, stream.bytes_written);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

// General splitflap includes
#include "config.h"
#include "src/splitflap_module.h"
#include "src/spi_io_config.h"
#include "splitflap_module.h"
#include "spi_io_config.h"

// ESP32-specific includes
#include "semaphore_guard.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "config.h"
#include "logger.h"
#include "src/splitflap_module_data.h"
#include "splitflap_module_data.h"
#include "configuration.h"

#include "task.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <Wire.h>

#include "Adafruit_MCP23017.h"
#include "src/Adafruit_INA219.h"
#include "Adafruit_INA219.h"

#include "result.h"
#include "../core/splitflap_task.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
*/

#include "../config.h"
#include "config.h"
#if INA219_POWER_SENSE

#include "Arduino.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* BSD license, all text here must be included in any redistribution.
*
*/
#include "../config.h"
#include "config.h"
#if INA219_POWER_SENSE
#ifndef _LIB_ADAFRUIT_INA219_
#define _LIB_ADAFRUIT_INA219_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

// NOTE: THIS FILE IS AUTOGENERATED! DO NOT MODIFY!
// To update, run `arduino/splitflap/Splitflap/src/generate_acceleration.py`
// To update, run `firmware/src/generate_acceleration.py`

#ifndef ACCELERATION
#define ACCELERATION
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "acceleration.h"
#include "splitflap_module_data.h"
#include "../config.h"
#include "config.h"

// Logging and assertions are useful for debugging, but likely add too much time/space overhead to be used when
// driving many SplitflapModules at once.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
#pragma once

#include "../config.h"
#include "config.h"

#if HOME_CALIBRATION_ENABLED
enum HomeState {
Expand Down
File renamed without changes.
22 changes: 14 additions & 8 deletions arduino/splitflap/platformio.ini → platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
src_dir = Splitflap
src_dir = firmware/src
lib_dir = firmware/lib
include_dir = firmware/include
test_dir = firmware/test
data_dir = firmware/data

; Note: change this to the target environment to get VSCode to handle code
; completion, etc, correctly.
Expand Down Expand Up @@ -65,7 +69,7 @@ monitor_filters = esp32_exception_decoder
board_build.partitions = default_ffat.csv

extra_scripts =
pre:buildscript_build_info_macros.py
pre:firmware/buildscript_build_info_macros.py

; This would be much cleaner if we didn't need to preserve Arduino IDE compatibility and the splitflap
; module driver could be pulled out to its own library and shared properly... Instead, we remove the
Expand Down Expand Up @@ -111,12 +115,6 @@ build_flags =
-DLOAD_GFXFF=1
-DSPI_FREQUENCY=40000000

[env:esp32]
extends=esp32base
build_flags =
${esp32base.build_flags}
-DNUM_MODULES=6

[env:chainlink]
extends=esp32base
build_flags =
Expand Down Expand Up @@ -153,3 +151,11 @@ lib_deps =
adafruit/Adafruit MCP23017 Arduino Library @ ^1.3.0
adafruit/Adafruit BusIO @ ^1.9.1
build_type = debug

[env:esp32CustomAdvanced]
; For non-chainlink custom ESP32-based advanced builds that use shift registers but omit the Chainlink design elements like loopbacks and LEDs.
; This is not the environment you want unless you have custom non-Chainlink hardware and really know the intricacies of the shift register arrangement.
extends=esp32base
build_flags =
${esp32base.build_flags}
-DNUM_MODULES=6
Loading