Skip to content

Commit aa4634b

Browse files
committed
Merge branch 'develop' into pr/168
2 parents 14bea7b + 6087ba7 commit aa4634b

File tree

511 files changed

+212596
-118623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

511 files changed

+212596
-118623
lines changed

.github/workflows/pre-commit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
if: steps.filter.outputs.software == 'true'
2929
uses: docker://kadaan/platformio_esp32:latest
3030
with:
31-
args: run
31+
args: --build=release

.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: (\.pio|lib/NimBLE-Arduino)/.*
1+
exclude: (\.pio|lib/NimBLE-Arduino|lib/ArduinoCompat)/.*
22
repos:
33
- repo: https://github.com/Lucas-C/pre-commit-hooks
44
rev: v1.1.9
@@ -31,10 +31,10 @@ repos:
3131
language: docker_image
3232
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
3333
entry: daverona/pre-commit-cpp:0.8.0 cpplint
34-
- id: docker-piocheck
35-
name: piocheck
36-
description: Run `pio check` against C/C++ source files in Docker container
34+
- id: docker-pio
35+
name: pio
36+
description: Run platformio check, test, and build C/C++ source files in Docker container
3737
language: docker_image
38-
files: \.(c|cc|cpp|cu|c\+\+|cxx|tpp|txx|ino)$
38+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
3939
pass_filenames: false
40-
entry: kadaan/platformio_esp32:latest check
40+
entry: kadaan/platformio_esp32:latest --check --test=native

.vscode/settings.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@
4242
"cinttypes": "cpp",
4343
"utility": "cpp",
4444
"typeinfo": "cpp",
45-
"string": "cpp"
45+
"string": "cpp",
46+
"climits": "cpp",
47+
"ble.h": "c",
48+
"os_mempool.h": "c",
49+
"ble_uuid.h": "c",
50+
"ble_hs_priv.h": "c",
51+
"nimble_opt.h": "c"
4652
},
4753
"C_Cpp.errorSquiggles": "Disabled"
4854
}

.vscode/tasks.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
"tasks": [
44
{
55
"type": "PlatformIO",
6-
"task": "Upload Filesystem Image (esp32doit)",
6+
"task": "Upload Filesystem Image (debug)",
77
"problemMatcher": [
88
"$platformio"
99
],
10-
"label": "PlatformIO: Upload Filesystem Image (esp32doit)"
10+
"label": "PlatformIO: Upload Filesystem Image (debug)"
1111
},
1212
{
1313
"type": "PlatformIO",
14-
"task": "Erase Flash (esp32doit)",
14+
"task": "Erase Flash (debug)",
1515
"problemMatcher": [
1616
"$platformio"
1717
],
18-
"label": "PlatformIO: Erase Flash (esp32doit)"
18+
"label": "PlatformIO: Erase Flash (debug)"
1919
},
2020
{
2121
"type": "PlatformIO",

CHANGELOG.md

+56-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,45 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
9+
### Added
10+
- BLE Custom Characteristic motor driver calls now apply settings received.
11+
- Motor current now automatically scales if ESP32 temp starts getting too high.
12+
- Added comments after compiler #endif Statements to make it easier to see what the partner #if statement is.
13+
- Added BLE_syncMode to support syncing shifterPosition with bikes that also report their resistance level.
14+
- Added git tag to prevent branch from downgrading to the last release.
15+
- Added Hardware Version 2.0.
16+
- MCWPWM for stepper control.
17+
- Erg Sensitivity control added.
18+
- Function to stop motor and release tension if the user stops pedaling in ERG mode.
19+
- Received BLE is now buffered and then processed.
20+
- Added Fitness Machine supported inclination range characteristic.
21+
22+
### Changed
23+
- Renamed BLE_stepperPosition to BLE_targetPosition to clarify the variable it controls.
24+
- Increased BLE communications task to 3500 stack.
25+
- Fixed recurring debugging line when driver was at normal temp.
26+
- Fixed length of returnValue on custom BLE bool read requests.
27+
28+
## [1.6.19] - 2021-6-19
29+
830
### Added
31+
- Initial implementation of the custom characteristic.
32+
- Added additional FTMS characteristics and some refactoring of shared variables
33+
- Added GZipped jQuery to fix non WAN connected manual updates.
34+
- Pin arduino-esp32 package to version 1.0.6 to fix build issue
35+
- Added + - Buttons to sliders.
36+
- Added firmware checklist to "~/" for PR and release candidate testing.
37+
- Added README.md to "~/Hardware/*" that provides help for the files contained within.
38+
- Added BakerEchelonStrap to "~/Hardware/Mounts/".
39+
- Added positive retention clip to "~/Hardware/Mounts".
40+
- Added Logan clip to "~/Hardware/Mounts".
41+
- Added experimental rigid mounting strap. * Fixed width to 65mm.
42+
- Add images for video links in Wiki Build How To.
43+
- Added webhook for simulated cadence.
44+
- Add image for video link in Build How To
45+
- Added images for video links in Wiki Build How To
46+
- Added XL (Extra Long) Mounting strap for Echelon.
947
- Added Insert Peloton 7 Flat V2 .sldpart and .stl.
1048
- Added initial credits file.
1149
- Added initial changelog.
@@ -16,8 +54,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1654
- Filter Flywheel advertisements by name.
1755
- Added unit tests for CyclePowerData.cpp
1856
- Add documentation to SensorData class.
57+
- Enabled native testing.
58+
- Added logging library which supports levels.
1959

2060
### Changed
61+
- Moved Vin to the correct side on the ESP32 connection diagram.
62+
- Power Correction Factor minimum value is now .5
63+
- Made Revmaster insert slightly smaller.
64+
- Fixed minor spulling errurs.
65+
- Reorganized hardware library into per part subfolders.
66+
- Updater shifter cover to version 9.
67+
- Fixed missing strap loops on non-pcb case.
68+
- Power Correction Factor slider now updates correctly.
69+
- Removed unused http onServer calls.
70+
- Repaired btsimulator.html
71+
- Shortened HR characteristic to 2 bytes (Polar OH1 format)
2172
- Increased ShiftStep UI slider range.
2273
- Replaced DoublePower setting with PowerCorrectionFactor setting.
2374
- Reverted bytes_to_u16 macro.
@@ -26,10 +77,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2677
- Updated Echelon Insert
2778
- Fixed many issues exposed by the addition of cpp-lint, pio check, and clang-format.
2879
- Fixed merge issues.
29-
- Fixed Echelon licences.
80+
- Fixed Echelon licenses.
3081
- Fix Flywheel power/cadence decoding.
31-
- Ignore zero heartrate reported from remote FTMS.
82+
- Ignore zero heart rate reported from remote FTMS.
3283
- Fix Assimoa Uno stuck cadence.
84+
- Started extract non-arduino code into a cross-platform library.
85+
- Changed all logging calls to new logging library.
3386

3487
### Removed
35-
- Deleted and ignored .pio folder which had been mistakening commited
88+
- Deleted and ignored .pio folder which had been mistakenly committed.

CPPLINT.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
# Don't search for additional CPPLINT.cfg in parent directories.
1818
set noparent
1919

20-
# Exclude third-party files
21-
exclude_files=\.pio|lib
22-
2320
# Limit line length.
2421
linelength=180
2522

CustomCharacteristic.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Please use and refer to the following notes for use of the custom characteristic:
2+
3+
Custom Characteristic for userConfig Variable manipulation via BLE
4+
5+
SMARTSPIN2K_SERVICE_UUID "77776277-7877-7774-4466-896665500000"
6+
SMARTSPIN2K_CHARACTERISTIC_UUID "77776277-7877-7774-4466-896665500001"
7+
8+
An example follows to read/write 26.3kph to simulatedSpeed:
9+
10+
simulatedSpeed is a float and first needs to be converted to int by *10 for transmission, so convert 26.3kph to 263 (multiply by 10)
11+
Decimal 263 == hexadecimal 0107 but the data needs to be converted to LSO, MSO to match the rest of the BLE spec so 263 == 0x07, 0x01 (LSO,MSO)
12+
13+
So,
14+
15+
If client wants to write (0x02) int value 263 (0x07 0x01) to simulatedSpeed(0x06):
16+
17+
Client Writes:
18+
0x02, 0x06, 0x07, 0x01
19+
(operator, variable, LSO, MSO)
20+
21+
Server will then indicate:
22+
0x80, 0x06, 0x07, 0x01
23+
(success),(simulatedSpeed),(LSO),(MSO)
24+
25+
Example to read (0x01) from simulatedSpeed (0x06)
26+
27+
Client Writes:
28+
0x01, 0x06
29+
Server will then indicate:
30+
0x80, 0x06, 0x07, 0x01
31+
(success),(simulatedSpeed),(0x07),(0x01)
32+
33+
Pay special attention to the float values. Since they have to be transmitted as an int, some are converted *100, others are converted *10.
34+
Refer to BLE_Server.cpp for which conversions to use.
35+
36+
True values are >00. False are 00.
37+
38+
Values in first byte:
39+
40+
Written:
41+
uint8_t read = 0x01; // value to request read operation
42+
uint8_t write = 0x02; // Value to request write operation
43+
44+
Indicated:
45+
uint8_t error = 0xff; // value server error/unable
46+
uint8_t success = 0x80; // value for success
47+
48+
From BLE_common.h
49+
//custom characteristic codes
50+
| Variable |uint8_t| type| Notes |
51+
|--------------------------|:-----:|-----|---------------------------------------------------|
52+
|BLE_firmwareUpdateURL |0x01 | |Not Implemented |
53+
|BLE_incline |0x02 |float|incline from app |
54+
|BLE_simulatedWatts |0x03 |int |simulated or read watts |
55+
|BLE_simulatedHr |0x04 |int |simulated or read HR |
56+
|BLE_simulatedCad |0x05 |float|simulated or read cadence |
57+
|BLE_simulatedSpeed |0x06 |float|Calculated speed |
58+
|BLE_deviceName |0x07 | |Not Implemented |
59+
|BLE_shiftStep |0x08 |int |Stepper steps per shifter button press |
60+
|BLE_stepperPower |0x09 |int |Stepper power in ma |
61+
|BLE_stealthchop |0x0A |bool |Stepper stealthchop on/off |
62+
|BLE_inclineMultiplier |0x0B |float|- multiplied by incline to get steps per % gradient|
63+
|BLE_powerCorrectionFactor |0x0C |float|.5 - 2.0 to calibrate power output |
64+
|BLE_simulateHr |0x0D |bool | |
65+
|BLE_simulateWatts |0x0E |bool | |
66+
|BLE_simulateCad |0x0F |bool | |
67+
|BLE_ERGMode |0x10 |bool | |
68+
|BLE_autoUpdate |0x11 |bool |updates on (01) or off (00) |
69+
|BLE_ssid |0x12 | |Not Implemented |
70+
|BLE_password |0x13 | |Not Implemented |
71+
|BLE_foundDevices |0x14 | |Not Implemented |
72+
|BLE_connectedPowerMeter |0x15 | |Not Implemented |
73+
|BLE_connectedHeartMonitor |0x16 | |Not Implemented |
74+
|BLE_shifterPosition |0x17 |int |That changes when a shift is preformed. |
75+
|BLE_saveToSpiffs |0x18 |bool |01 written will save to spiffs. |
76+
|BLE_targetPosition |0x19 |int36|Position (in steps) the motor is maintaining. |
77+
|BLE_externalControl |0x1A |bool |01 disables internal calculation of targetPosition.|
78+
|BLE_syncMode |0x1B |bool |01 stops motor movement for external calibration |
79+
80+
*syncMode will disable the movement of the stepper motor by forcing stepperPosition = targetPosition prior to the motor control. While this mode is enabled, it allows the client to set parameters like incline and shifterPosition without moving the motor from it's current position. Once the parameters are set, this mode should be turned back off and SS2K will resume normal operation.
81+
82+
83+
This characteristic also notifies when a shift is preformed or the button is pressed.
84+
85+
See code for more references/info in BLE_Server.cpp starting on line 534

Hardware/Bottom_Case.stl

-1.74 MB
Binary file not shown.
2.58 MB
Binary file not shown.
File renamed without changes.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Which case do I need?
2+
3+
Use the Bottom_Case for the whole DIY experience. It provides additional mounts inside for the stepper driver and the buck converter.
4+
5+
The Bottom_Case_PCB is for those that use the pcb from pcbway. It's much simplier and cleaner wiring but requires more parts to be purchased (Components for the PCB).
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Tall_Cover_w_brace is primarily for shipping but may also provide some added durability as it supports the top of the stepper motor.
2+
3+
Tall_Cover is slightly more flexible and may provide room for different size stepper motors.

0 commit comments

Comments
 (0)