Skip to content

Commit

Permalink
Merge branch 'develop' into Builtin.h_Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
doudar committed Dec 26, 2023
2 parents 258464d + 7f2484e commit 8811d1c
Show file tree
Hide file tree
Showing 31 changed files with 2,190 additions and 409 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Ensure changelog is updated
uses: dangoslen/[email protected]
- name: Set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
architecture: 'x64'
Expand Down Expand Up @@ -53,12 +53,12 @@ jobs:
run: |
7z a SmartSpin2kFirmware-${{ steps.date.outputs.date }}.bin.zip ./.pio/build/release/*.bin
- name: Archive
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: all-artifacts
path: SmartSpin2kFirmware-${{ steps.date.outputs.date }}.bin.zip
- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: all-artifacts
- name: Get tag info
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
- name: Ensure changelog is updated
uses: dangoslen/[email protected]
- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
- name: Check pre-commit hooks
uses: pre-commit/[email protected]
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Added a custom integrated implementation of WifiManager.
- Added pass through shifting in both ERG and SIM mode. - Added a custom integrated implementation of WifiManager.

### Changed
- Updated communications overview picture.
Expand All @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- MIN_ERG_CADENCE created and changed from 20 to 30.
- Fixed DNS server in AP mode.
- Fixed an issue with IC4 and variants not displaying device name in Bluetooth scanner. Fixes #500
- Switched from using Power Table to a Torque Table for better compensation in cad variations.
- added test for invalid Peloton data to keep stepper from running away without resistance information.

### Hardware
- Wire diameter reduced from 7.2mm to 6.0mm on the window passthrough to accommodate the latest batch of cables.
Expand All @@ -32,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added Peloton low profile (for slammed bars) bike mount by @chaloney
- Updated CAD for the case to work flawlessly with small tweaks to motor height.
- Removed some free play in the IC4 insert.
- Added Bowflex Velocore bike.

## [23.6.28]
### Added
Expand Down
1 change: 1 addition & 0 deletions Hardware/Common Assets/Arm/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Manufacturer|Model|Year|Arm Length (range)
BH Fitness||Any|50
Body Bike|Body Bike|Any|50 (Steep angle)
Bowflex|C6|Any|85
Bowflex|Velocore|150
Echelon|Connect Sport|Any| 105
HMC|HMC|Any|60mm
Joroto|X2|Any|20
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1,566 changes: 1,566 additions & 0 deletions Hardware/Common Assets/Inserts/Solidworks_Designs/BowFlex_Velocore.STEP

Large diffs are not rendered by default.

Binary file not shown.
Binary file added Hardware/Common Assets/Inserts/YOSUDA_PRO.STL
Binary file not shown.
172 changes: 7 additions & 165 deletions include/BLE_Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#include <memory>
#include <NimBLEDevice.h>
#include <Arduino.h>
#include <Main.h>
#include "Main.h"
#include "BLE_Definitions.h"

#define BLE_CLIENT_LOG_TAG "BLE_Client"
#define BLE_COMMON_LOG_TAG "BLE_Common"
Expand Down Expand Up @@ -167,6 +168,8 @@ class SpinBLEAdvertisedDevice {
};

class SpinBLEClient {
private:

public: // Not all of these need to be public. This should be cleaned up
// later.
boolean connectedPM = false;
Expand Down Expand Up @@ -194,9 +197,9 @@ class SpinBLEClient {
// Check for duplicate services of BLEClient and remove the previously
// connected one.
void removeDuplicates(NimBLEClient *pClient);
void resetDevices(NimBLEClient *pclient);
void resetDevices(NimBLEClient *pClient);
void postConnect();
void FTMSControlPointWrite(const uint8_t *pData, int length);
void FTMSControlPointWrite(const uint8_t* pData, int length);
void connectBLE_HID(NimBLEClient *pClient);
void keepAliveBLE_HID(NimBLEClient *pClient);
void checkBLEReconnect();
Expand All @@ -217,165 +220,4 @@ class MyClientCallback : public NimBLEClientCallbacks {
void onAuthenticationComplete(ble_gap_conn_desc);
};

extern SpinBLEClient spinBLEClient;

// https://www.bluetooth.com/specifications/specs/fitness-machine-service-1-0/
// Table 4.13: Training Status Field Definition
struct FitnessMachineTrainingStatus {
enum Types : uint8_t {
Other = 0x00,
Idle = 0x01,
WarmingUp = 0x02,
LowIntensityInterval = 0x03,
HighIntensityInterval = 0x04,
RecoveryInterval = 0x05,
Isometric = 0x06,
HeartRateControl = 0x07,
FitnessTest = 0x08,
SpeedOutsideOfControlRegionLow = 0x09,
SpeedOutsideOfControlRegionHigh = 0x0A,
CoolDown = 0x0B,
WattControl = 0x0C,
ManualMode = 0x0D,
PreWorkout = 0x0E,
PostWorkout = 0x0F,
// Reserved for Future Use 0x10-0xFF
};
};

// https://www.bluetooth.com/specifications/specs/fitness-machine-service-1-0/
// Table 4.24: Fitness Machine Control Point characteristic – Result Codes
struct FitnessMachineControlPointResultCode {
enum Types : uint8_t {
ReservedForFutureUse = 0x00,
Success = 0x01,
OpCodeNotSupported = 0x02,
InvalidParameter = 0x03,
OperationFailed = 0x04,
ControlNotPermitted = 0x05,
// Reserved for Future Use = 0x06-0xFF
};
};

// https://www.bluetooth.com/specifications/specs/fitness-machine-service-1-0/
// Table 4.3: Definition of the bits of the Fitness Machine Features field
struct FitnessMachineFeatureFlags {
enum Types : uint {
AverageSpeedSupported = 1U << 0,
CadenceSupported = 1U << 1,
TotalDistanceSupported = 1U << 2,
InclinationSupported = 1U << 3,
ElevationGainSupported = 1U << 4,
PaceSupported = 1U << 5,
StepCountSupported = 1U << 6,
ResistanceLevelSupported = 1U << 7,
StrideCountSupported = 1U << 8,
ExpendedEnergySupported = 1U << 9,
HeartRateMeasurementSupported = 1U << 10,
MetabolicEquivalentSupported = 1U << 11,
ElapsedTimeSupported = 1U << 12,
RemainingTimeSupported = 1U << 13,
PowerMeasurementSupported = 1U << 14,
ForceOnBeltAndPowerOutputSupported = 1U << 15,
UserDataRetentionSupported = 1U << 16
};
};

// https://www.bluetooth.com/specifications/specs/fitness-machine-service-1-0/
// Table 4.4: Definition of the bits of the Target Setting Features field
struct FitnessMachineTargetFlags {
enum Types : uint {
SpeedTargetSettingSupported = 1U << 0,
InclinationTargetSettingSupported = 1U << 1,
ResistanceTargetSettingSupported = 1U << 2,
PowerTargetSettingSupported = 1U << 3,
HeartRateTargetSettingSupported = 1U << 4,
TargetedExpendedEnergyConfigurationSupported = 1U << 5,
TargetedStepNumberConfigurationSupported = 1U << 6,
TargetedStrideNumberConfigurationSupported = 1U << 7,
TargetedDistanceConfigurationSupported = 1U << 8,
TargetedTrainingTimeConfigurationSupported = 1U << 9,
TargetedTimeTwoHeartRateZonesConfigurationSupported = 1U << 10,
TargetedTimeThreeHeartRateZonesConfigurationSupported = 1U << 11,
TargetedTimeFiveHeartRateZonesConfigurationSupported = 1U << 12,
IndoorBikeSimulationParametersSupported = 1U << 13,
WheelCircumferenceConfigurationSupported = 1U << 14,
SpinDownControlSupported = 1U << 15,
TargetedCadenceConfigurationSupported = 1U << 16
};
};

// https://www.bluetooth.com/specifications/specs/fitness-machine-service-1-0/
// Table 4.16.1: Fitness Machine Control Point Procedure Requirements
struct FitnessMachineControlPointProcedure {
enum Types : uint8_t {
RequestControl = 0x00,
Reset = 0x01,
SetTargetSpeed = 0x02,
SetTargetInclination = 0x03,
SetTargetResistanceLevel = 0x04,
SetTargetPower = 0x05,
SetTargetHeartRate = 0x06,
StartOrResume = 0x07,
StopOrPause = 0x08,
SetIndoorBikeSimulationParameters = 0x11,
SetWheelCircumference = 0x12,
SpinDownControl = 0x13,
SetTargetedCadence = 0x14,
// Reserved for Future Use 0x15-0x7F
ResponseCode = 0x80
// Reserved for Future Use 0x81-0xFF
};
};

// https://www.bluetooth.com/specifications/specs/fitness-machine-service-1-0/
// Table 4.17: Fitness Machine Status
struct FitnessMachineStatus {
enum Types : uint {
ReservedForFutureUse = 0x00,
Reset = 0x01,
StoppedOrPausedByUser = 0x02,
StoppedOrPausedBySafetyKey = 0x03,
StartedOrResumedByUser = 0x04,
TargetSpeedChanged = 0x05,
TargetInclineChanged = 0x06,
TargetResistanceLevelChanged = 0x07,
TargetPowerChanged = 0x08,
TargetHeartRateChanged = 0x09,
IndoorBikeSimulationParametersChanged = 0x12,
WheelCircumferenceChanged = 0x13,
SpinDownStatus = 0x14,
TargetedCadenceChanged = 0x15,
// Reserved for Future Use 0x16-0xFE
ControlPermissionLost = 0xFF
};
};

inline FitnessMachineFeatureFlags::Types operator|(FitnessMachineFeatureFlags::Types a, FitnessMachineFeatureFlags::Types b) {
return static_cast<FitnessMachineFeatureFlags::Types>(static_cast<int>(a) | static_cast<int>(b));
}

inline FitnessMachineTargetFlags::Types operator|(FitnessMachineTargetFlags::Types a, FitnessMachineTargetFlags::Types b) {
return static_cast<FitnessMachineTargetFlags::Types>(static_cast<int>(a) | static_cast<int>(b));
}

struct FitnessMachineFeature {
union {
struct {
union {
enum FitnessMachineFeatureFlags::Types featureFlags;
uint8_t bytes[4];
} featureFlags;
union {
enum FitnessMachineTargetFlags::Types targetFlags;
uint8_t bytes[4];
} targetFlags;
};
uint8_t bytes[8];
};
};

struct FtmsStatus {
uint8_t data[8];
int length;
};
extern SpinBLEClient spinBLEClient;
Loading

0 comments on commit 8811d1c

Please sign in to comment.