Skip to content

Commit

Permalink
Merge branch 'develop' into ConfigApp
Browse files Browse the repository at this point in the history
  • Loading branch information
eMadman authored Mar 15, 2024
2 parents 1c61cca + 4339bdf commit 3affcd4
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 8 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/update_ota_repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Update OTA Repository

on:
workflow_run:
workflows: ["build"]
branches: [develop]
types:
- completed

jobs:
update-ota:
runs-on: ubuntu-latest
steps:
- name: Checkout OTA Updates Repository
uses: actions/checkout@v4
with:
repository: 'doudar/OTAUpdates'
token: ${{ secrets.OTA_TOKEN }} # Use your secret token here
path: 'OTAUpdates'

- name: Get Latest Release from SmartSpin2k
id: get-release
uses: actions/github-script@v7
with:
script: |
const repo = {
owner: 'doudar',
repo: 'SmartSpin2k',
};
const response = await github.rest.repos.getLatestRelease(repo);
const assets = response.data.assets.filter(asset => asset.name.includes('.bin.zip'));
if (assets.length === 0) {
core.setFailed('No .bin.zip assets found in the latest release.');
return; // This stops the script execution if no assets are found
}
const url = assets[0].browser_download_url;
const tag_name = response.data.tag_name;
core.setOutput('url', url);
core.setOutput('tag_name', tag_name);
- name: Download Artifacts
if: steps.get-release.outputs.url
run: |
curl -L "${{ steps.get-release.outputs.url }}" -o firmware.zip
mkdir firmware/
unzip firmware.zip -d firmware
ls -R firmware # List files for diagnostics
- name: Process Version and Files
run: |
VERSION_TAG="${{ steps.get-release.outputs.tag_name }}"
PROCESSED_VERSION="${VERSION_TAG%-*}"
echo $PROCESSED_VERSION > version.txt
ls
# Copy the .bin files directly as they are now confirmed to be in the 'firmware' directory
cp ./firmware/*.bin ./
# Ensure we're listing files here for a final check, remove in the final workflow
ls -la
working-directory: ./OTAUpdates

- name: Commit and Push Updates to OTAUpdates Repository
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Update firmware and LittleFS with version ${{ steps.get-release.outputs.tag_name }}'
add: './*'
cwd: './OTAUpdates'
pull_strategy: 'NO-PULL'
push: true
env:
GITHUB_TOKEN: ${{ secrets.OTA_TOKEN }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- added test for invalid Peloton data to keep stepper from running away without resistance information.
- Fixed a bug with Trainer Day and rapid ERG sending.
- Many updates and bug fixes which enable the Config App to communicate with SmartSpin2k.
- Scanned devices no longer saved to filesystem. The new scanning method would keep snowballing them otherwise.
- increased MTU for android

### Hardware
Expand Down
9 changes: 4 additions & 5 deletions src/HTTP_Server_Basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,13 @@ void startWifi() {

// Couldn't connect to existing network, Create SoftAP
if (WiFi.status() != WL_CONNECTED) {
String t_pass = DEFAULT_PASSWORD;
if (String(userConfig->getSsid()) == DEVICE_NAME) {
if (strcmp(userConfig->getSsid(), DEVICE_NAME) == 0) {
// If default SSID is still in use, let the user
// select a new password.
// Else Fall Back to the default password (probably "password")
String t_pass = String(userConfig->getPassword());
}
WiFi.softAP(userConfig->getDeviceName(), t_pass.c_str());
WiFi.softAP(userConfig->getDeviceName(), userConfig->getPassword());
}else{
WiFi.softAP(userConfig->getDeviceName(), DEFAULT_PASSWORD);}
vTaskDelay(50);
myIP = WiFi.softAPIP();
/* Setup the DNS server redirecting all the domains to the apIP */
Expand Down
8 changes: 5 additions & 3 deletions src/SmartSpin_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void userParameters::saveToLittleFS() {
doc["connectedPowerMeter"] = connectedPowerMeter;
doc["connectedHeartMonitor"] = connectedHeartMonitor;
doc["connectedRemote"] = connectedRemote;
doc["foundDevices"] = foundDevices;
//doc["foundDevices"] = foundDevices;
doc["maxWatts"] = maxWatts;
doc["minWatts"] = minWatts;
doc["shifterDir"] = shifterDir;
Expand Down Expand Up @@ -193,8 +193,10 @@ void userParameters::loadFromLittleFS() {
setPassword(doc["password"]);
setConnectedPowerMeter(doc["connectedPowerMeter"]);
setConnectedHeartMonitor(doc["connectedHeartMonitor"]);
setFoundDevices(doc["foundDevices"]);
if (doc["ERGSensitivity"]) { // If statements to upgrade old versions of config.txt that didn't include these
//setFoundDevices(doc["foundDevices"]);

// If statements to upgrade old versions of config.txt that didn't include these
if (doc["ERGSensitivity"]) {
setERGSensitivity(doc["ERGSensitivity"]);
}
if (doc["maxWatts"]) {
Expand Down

0 comments on commit 3affcd4

Please sign in to comment.