Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
edebe73
Add constructors
cujomalainey Jan 14, 2018
da59eb9
Typo in defines
cujomalainey Apr 21, 2018
650d84a
Merge branch 'profiles/heart-rate/monitor' into core/base-master
cujomalainey Jun 7, 2019
f841494
BaseMaster: Handle request datapages in the base profile
cujomalainey Jun 12, 2019
91cb627
Travis: Missed a couple arguements in base master
cujomalainey Jun 12, 2019
d3c5962
Merge branch 'develop' into core/base-master
cujomalainey Jun 20, 2019
d1cc986
Shifting: First shot, not yet tested master channel
Sepp62 Jun 13, 2019
61bcd2f
Merge branch 'core/base-master' into temp/shifter
cujomalainey Jun 22, 2019
4a424ed
Shifting: Some correction after code review
Sepp62 Jun 14, 2019
8447fbc
Shifting: ShiftingBaseGenericMsg() base class removed
Sepp62 Jun 15, 2019
7968f08
Shifting: _eventCount bug removed
Sepp62 Jun 15, 2019
b4f9f17
Shifting: Refactoring manufacturer and product information
Sepp62 Jun 21, 2019
5f5a944
Shifting: Some minor adaptions due to pull request conversation
Sepp62 Jun 21, 2019
89d3cd2
Shifting: Refactoring Moxy and Shifting for product and manufacturer …
Sepp62 Jun 21, 2019
ad0e539
Shifting: Merge conflict resolution error
cujomalainey Jun 22, 2019
d5ff5e5
MuscleOxygen: First shot of muscle oxygen monitor profile, rudimentar…
Sepp62 Jun 13, 2019
c70740f
MuscleOxygen: Refactoring consistent to "shifter"
Sepp62 Jun 15, 2019
5384e61
MuscleOxygen: isDataPageValid() changed
Sepp62 Jun 15, 2019
d5f3740
MOxy: Adapted to new msg balse classes for manufacturer and product
Sepp62 Jun 21, 2019
72941b5
MOxy: Refactoring Moxy and Shifting for product and manufacturer info…
Sepp62 Jun 21, 2019
ea4ed6d
MOxy: Refactoring manufacturer and product information
Sepp62 Jun 21, 2019
467199c
MOxy: Merge conflict cleanup
cujomalainey Jun 22, 2019
312a94e
Merge branch 'develop' into profiles/environment/display
cujomalainey Jun 28, 2019
cf9c119
Environment: Display: use generic callback for generic details
cujomalainey Jun 28, 2019
851e53d
Merge branch 'develop' into profiles/shifting/shifter
cujomalainey Aug 1, 2019
cd264e4
Merge branch 'develop' into profiles/moxy/monitor
cujomalainey Aug 1, 2019
6008fed
Shifting: Datapages: Refactor to new structure
cujomalainey Aug 7, 2019
5ffaf91
CommonDataPages: Fix include
cujomalainey Aug 7, 2019
c88a080
CommonDataPages: Add BatteryStatus
cujomalainey Aug 15, 2019
f888a1b
CommonDataPages: Refactor RequestDataPageMsg
cujomalainey Aug 15, 2019
cd5873d
CommonDataPages: Add MultiComponentSystemProductInformation datapage
cujomalainey Aug 15, 2019
f09e463
CommonDataPages: Add Multi Component System Manufacturers Information
cujomalainey Aug 24, 2019
20ce74e
Shifting: Shifter: Add todo about transmission pattern quirk
cujomalainey Aug 24, 2019
8475143
CommonDataPages: Add missing public declarations
cujomalainey Aug 25, 2019
320821d
Merge branch 'develop' into profiles/shifting/shifter
cujomalainey Aug 25, 2019
ff208d7
Shifting: Shifter: Initial cleanup
cujomalainey Aug 25, 2019
5acd516
Shifting: Shifter: Add additional datapges to callback
cujomalainey Aug 25, 2019
c9d3bd5
Shifting: Shifter: Add shift counter for transmission pattern
cujomalainey Aug 25, 2019
48f59c2
Shifting: Shifter: Add datapage callbacks
cujomalainey Aug 25, 2019
f0452d0
examples: ShiftingShifter: rename example
cujomalainey Aug 28, 2019
1903989
Shifting: Shifter: Add example to travis
cujomalainey Aug 28, 2019
48a8faf
Shifting: Shifter: Fix callback name
cujomalainey Aug 28, 2019
cef619b
examples:ShiftingShifter: Fix callback types and add missing callback
cujomalainey Aug 28, 2019
ef4f800
shifting: datapages: fix naming
cujomalainey Aug 28, 2019
87dfa8c
examples: ShiftingShifter: fix callback
cujomalainey Aug 28, 2019
c03d486
CommonDataPages: remove unneeded return
cujomalainey Aug 28, 2019
aa51cc2
examples: ShiftingShifter: fix function naming
cujomalainey Aug 28, 2019
7c9f92e
MuscleOxygen: DataPages: Begin refactor
cujomalainey Sep 2, 2019
2f03d1d
CommonDataPages: Add databuffer for messages
cujomalainey Sep 8, 2019
531253d
Shifting: Shifter: Update example
cujomalainey Sep 8, 2019
64a76fa
Shifting: Shifter: Remove init delay
cujomalainey Sep 8, 2019
7e95ed3
CommonDataPages: BatteryStatus: Add missing defines and set reserved
cujomalainey Oct 13, 2019
70a3b60
CommonDataPages: ManufacturersInformation: Remove unneeded header
cujomalainey Oct 13, 2019
3f8f559
CommonDataPages: MultiComponent: Set datapage number
cujomalainey Oct 13, 2019
2c7affb
Shifting: Defines: Add component identifier defines
cujomalainey Oct 14, 2019
89a88c2
Shifting: Shifter: Refactor Multi-component datapage mechanisms
cujomalainey Oct 14, 2019
5d32d2a
Merge branch 'develop' into profiles/shifting/shifter
cujomalainey Dec 26, 2019
8389ea9
BaseClasses: Add additional BaseMaster Utils
cujomalainey Dec 26, 2019
f3a3cdf
shifting: Ignore invalid component requests
cujomalainey Dec 26, 2019
a7e287e
shifting: shifter: Handle descriptor byte from requests
cujomalainey Dec 26, 2019
5ae96fe
FEC and BicyclePower profile
JunOllyLi May 19, 2020
7edc67f
Merge pull request #26 from JunOllyLi/fec
cujomalainey Oct 26, 2020
d7b35d0
BicyclePower: Remove if 0's
cujomalainey Oct 26, 2020
c53d514
BicyclePower: minor cleanup
cujomalainey Oct 26, 2020
bcd5705
BicyclePower: Add missing handle request function
cujomalainey Oct 26, 2020
09c49e8
BicyclePower: remove mode settings
cujomalainey Oct 26, 2020
75b400a
BicyclePower: factor out heart rate defines
cujomalainey Oct 27, 2020
94208d5
BicyclePower: Stub out data page functions
cujomalainey Oct 27, 2020
96b0aee
BicyclePower: remove datapage state machine
cujomalainey Oct 27, 2020
71422cc
BicyclePower: Refactor msg names to match datasheet
cujomalainey Oct 28, 2020
37ea4cb
FEC: fix callback name
cujomalainey Oct 28, 2020
edc448d
BicyclePower: remove undefined function
cujomalainey Oct 28, 2020
4e56701
Added Bicycle Power
sporkfly Dec 26, 2020
9dbd81b
Added example for Bicycle Power Display
sporkfly Dec 26, 2020
cb8d52c
Update BicyclePowerDisplay.ino
sporkfly Dec 26, 2020
1a000fd
Merge pull request #28 from sporkfly/sporkfly-antplus-arduino-power
cujomalainey Jan 10, 2021
f5a8e0d
travis: add bicycle power example
cujomalainey Jan 10, 2021
b11e449
power: fixup travis build failures for display example
cujomalainey Jan 10, 2021
3fd57cf
power: convert to unix line endings
cujomalainey Jan 10, 2021
582d417
Merge remote-tracking branch 'origin/develop' into merge/sporkfly
cujomalainey Jan 10, 2021
5e3c047
power: switch tabs to spaces and remove unneeded comments
cujomalainey Jan 11, 2021
22d2a32
Merge branch 'profiles/shifting/shifter' into develop
cujomalainey Jan 12, 2021
ddeaf40
shifting: update callbacks
cujomalainey Jan 12, 2021
31ead3d
Merge branch 'profiles/bike-speed-cadence/speed-display' into develop
cujomalainey Jan 12, 2021
2f0fd18
Merge branch 'profiles/environment/display' into develop
cujomalainey Jan 12, 2021
a0fc7f3
Merge branch 'profiles/environment/monitor' into develop
cujomalainey Jan 12, 2021
63a6f44
dynamic profiles: fix typo
cujomalainey Jan 12, 2021
cf5b443
travis: uprade python version
cujomalainey Jan 12, 2021
95d221c
FEC: enable display profile
cujomalainey Jan 12, 2021
60c4d8c
power: switch battery status to common data page
cujomalainey Jan 10, 2021
6c97893
power: switch to common manufacturersinformatino datapage
cujomalainey Jan 13, 2021
3c0da2c
power: use common product_id datapage
cujomalainey Jan 13, 2021
bf560e6
moxy: add muscle oxygen data message
cujomalainey Jan 13, 2021
b8960b4
moxy: fixup transmission pattern
cujomalainey Jan 13, 2021
cd54786
moxy: update callbacks
cujomalainey Jan 13, 2021
c4277a9
Merge branch 'profiles/moxy/monitor' into develop
cujomalainey Jan 13, 2021
c2de1f8
moxy: fix header path error
cujomalainey Jan 13, 2021
54c5ec5
moxy: fix header include for oxygend data
cujomalainey Jan 13, 2021
bf963de
moxy: fix datapage calls
cujomalainey Jan 13, 2021
900b225
moxy: fixup monitor example with new ant-arduino types
cujomalainey Jan 13, 2021
18faa33
moxy: fixup callbacks
cujomalainey Jan 13, 2021
21ec87e
baseprofile: init all members
cujomalainey Jan 13, 2021
14c894f
cppcheck: fixup missing explicit keywords
cujomalainey Jan 16, 2021
7dcff87
cppcheck: add explicit to construtors
cujomalainey Jan 16, 2021
57e44a3
heartrate: refactor datapages
cujomalainey Jan 16, 2021
52b815c
heartrate: move defines into datapages
cujomalainey Jan 16, 2021
b033b46
heartrate: move profile implementations into common folder
cujomalainey Jan 16, 2021
7e96df9
power: refactor datapages step 1
cujomalainey Jan 16, 2021
6edf626
power: move defines out
cujomalainey Jan 16, 2021
7bea54b
power: move to common profiles folder
cujomalainey Jan 16, 2021
ee99d2c
shifting: add todo marker
cujomalainey Jan 16, 2021
0d96366
heartrate: remove unneeded header
cujomalainey Jan 16, 2021
0817ff6
Merge branch 'develop' of https://github.com/cujomalainey/antplus-ard…
cujomalainey Jan 17, 2021
ddfbbf0
power: fixup example
cujomalainey Jan 17, 2021
a9a6863
CommonDataPages: refactor step 1
cujomalainey Jan 17, 2021
60c5ca4
CommonDataPages: refactor step 2
cujomalainey Jan 18, 2021
ad3a570
BicycleSpeed: refactor step 1
cujomalainey Jan 18, 2021
902ff27
heartrate: fix up some formating
cujomalainey Jan 18, 2021
1ed2442
Scale back generalization of datapage numbers
cujomalainey Jan 18, 2021
7bcbe4a
BicycleSpeed: localize defines
cujomalainey Jan 19, 2021
490fc38
power: fixup channel config names
cujomalainey Jan 19, 2021
22c2f8b
heartrate: fixup channel config names
cujomalainey Jan 19, 2021
9d6e7b1
BicycleSpeed: consolidate profile implementations
cujomalainey Jan 19, 2021
e550da0
BicycleSpeed: add core class implementations
cujomalainey Jan 19, 2021
93fec08
environment: consolidate datapages
cujomalainey Jan 19, 2021
249fee4
Environment: localize defines
cujomalainey Jan 19, 2021
bc5138a
Enviroment: consolidate profiles
cujomalainey Jan 19, 2021
6a6eae2
fec: consolidate messages
cujomalainey Jan 19, 2021
17542ce
power: fixup print in example
cujomalainey Jan 19, 2021
5440624
fec: expand acronym and cleanup
cujomalainey Jan 19, 2021
2a93894
fec: localize defines
cujomalainey Jan 20, 2021
4cf8c79
FEC: anonymize profile directory
cujomalainey Jan 21, 2021
9da936b
LEV: consolidate datapages
cujomalainey Jan 21, 2021
4e708bc
fec: undo name expansion, its too long
cujomalainey Jan 21, 2021
c0f4ee5
profiles: fix datapage header name prefix
cujomalainey Jan 25, 2021
0e68cfb
lev: localize defines
cujomalainey Jan 25, 2021
6e94e09
lev: consolidate profiles
cujomalainey Jan 25, 2021
35d7caa
moxy: consoilidate datapges
cujomalainey Jan 25, 2021
3571504
circleci: upgrade python for circleci
cujomalainey Feb 1, 2021
75eaee6
Merge branch 'master' into develop
cujomalainey Feb 1, 2021
dbf6a98
muslceoxygen: clean up todo, fix datapge number bug and defines
cujomalainey Feb 7, 2021
d04ac44
MuscleOxygen: fixup existing defines
cujomalainey Feb 7, 2021
b69b077
profiles: enforce transmission type for master profiles
cujomalainey Feb 7, 2021
c026b3d
heartrate: updpate set to core format
cujomalainey Feb 8, 2021
d2bf2d1
heartrate: fixup reserved set
cujomalainey Feb 8, 2021
4d7d538
shifting: multiple fixes
cujomalainey Feb 8, 2021
e44b0f1
shifting: fixup magic nums and api calls
cujomalainey Feb 8, 2021
5889d81
shifting: remove magic numbers and fix formatting
cujomalainey Feb 8, 2021
38f140a
bicyclepower: add crank torque frequency support
cujomalainey Feb 8, 2021
4b1af6c
router: use open rx channel defines
cujomalainey Feb 8, 2021
3cf36fd
common: fix magic nums and api set
cujomalainey Feb 8, 2021
4ee619e
bicyclepower: add TX types and fill out sensor
cujomalainey Feb 8, 2021
1ebe65b
common: add explicit constructor and optimize
cujomalainey Feb 8, 2021
db5be39
bicyclepower: add initializer for callbacks
cujomalainey Feb 8, 2021
9dbd8cc
bicyclespeed: add callback initializer
cujomalainey Feb 8, 2021
48a3eda
environment: add callback initializers
cujomalainey Feb 8, 2021
60eed48
bicyclepower: add callback initializers
cujomalainey Feb 8, 2021
b0263fd
bicyclepower: add override
cujomalainey Feb 8, 2021
4d7b61f
HeartRate: initialize callbacks
cujomalainey Feb 8, 2021
0e03c8e
fec: optimize constructors for display
cujomalainey Feb 9, 2021
812a0fe
fec: initialize all members
cujomalainey Feb 9, 2021
b77261a
heartrate: display: initialize all members
cujomalainey Feb 9, 2021
d1f8c46
lev: display: optimize constructors
cujomalainey Feb 9, 2021
8c44357
lev: display: initialize all members
cujomalainey Feb 9, 2021
5f1eef8
bicyclepower: sensor: mark constructor as explicit
cujomalainey Feb 9, 2021
1685a8b
shifting: shifter: initialize all members
cujomalainey Feb 9, 2021
0694b1f
MuscleOxygen: Monitor: initialize all members
cujomalainey Feb 9, 2021
8b70da4
core: remove some whitespace
cujomalainey Feb 9, 2021
489bf46
Fec: add overrides
cujomalainey Feb 9, 2021
127518c
cppcheck: add some more explicit keywords
cujomalainey Feb 9, 2021
c72dc17
shifting: remove core class
cujomalainey Feb 9, 2021
06be04b
fec: remove unneccessary func
cujomalainey Feb 9, 2021
d9eb4cc
muscleoxygen: monitor: add override flags
cujomalainey Feb 9, 2021
cae0083
environment: monitor: add explicit flags to construct
cujomalainey Feb 9, 2021
9cdfa33
profiles: add comments name level out logic
cujomalainey Feb 9, 2021
734e1a6
MuscleOxygen: delete empty file
cujomalainey Feb 9, 2021
a5d2169
MuscleOxygen: add commands datapage
cujomalainey Feb 10, 2021
5e5c02c
lev: update set call
cujomalainey Feb 10, 2021
2ae4378
MuscleOxygen: set reserver byte for command msg
cujomalainey Feb 16, 2021
6fad78c
MuscleOxygen: add batterystatus support
cujomalainey Apr 26, 2021
fbf1633
ci: fix unit tests
cujomalainey Apr 27, 2021
b23977a
moxy: add support for requesting required common pages
cujomalainey Apr 27, 2021
d44e809
BicyclePower: Refactor transmission patterns
cujomalainey May 3, 2021
301ff21
MuscleOxygen: fix cppcheck warning
cujomalainey May 3, 2021
ea0aa7e
BicyclePower: Refactor transimission patterns
cujomalainey May 27, 2021
a0a28e5
BicyclePower: Add TE & PS Main Data Page support for power only
cujomalainey Jul 15, 2021
1ae5b77
BicyclePower: Add isDataPageValid implementation
cujomalainey Jul 15, 2021
ad97ddd
BicyclePower: Add Product and Mannufacturers Information Hooks
cujomalainey Jul 15, 2021
9b5080f
HeartRate: Remove unneeded flags
cujomalainey Jul 18, 2021
1f3dea8
BicyclePower: expose multiple sensor type flags
cujomalainey Jul 18, 2021
cfbc214
examples: DeviceSearch: Add more device types
cujomalainey Aug 8, 2021
bb0b354
BicyclePower: PowerOnly: Fix typo
cujomalainey Aug 8, 2021
505b88b
BicyclePower: PowerOnly: Migrate to new byte API
cujomalainey Aug 8, 2021
ed54382
BicyclePower: CrankTorque: fix comment typo
cujomalainey Aug 8, 2021
b341191
Examples: BicyclePowerSensor: Add example
cujomalainey Aug 8, 2021
4c784e3
HeartRate: DataPages: Fixup data access API
cujomalainey Aug 8, 2021
f656fe7
CommonDataPages: Fixup direct buffer access
cujomalainey Aug 8, 2021
17092df
DataPages: remove memset and default values
cujomalainey Aug 8, 2021
c2037ed
CommonDataPages: Add ModeSettingsMsg
cujomalainey Aug 8, 2021
4172109
Examples: HeartRateDisplay: utilize all definitions
cujomalainey Aug 8, 2021
92723f2
BicyclePower: Fix defines and remove magic numbers
cujomalainey Aug 8, 2021
4a3c4b3
add new datapages
cfournel Jan 13, 2022
29c1cd9
add example for native driver
cfournel Jan 13, 2022
5f69e1b
update native example
Jan 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ jobs:
strategy:
matrix:
example: [
examples/BicyclePowerDisplay/BicyclePowerDisplay.ino,
examples/BicyclePowerSensor/BicyclePowerSensor.ino,
examples/BicycleSpeedDisplay/BicycleSpeedDisplay.ino,
examples/DeviceSearch/DeviceSearch.ino,
examples/DynamicProfiles/DynamicProfiles.ino,
examples/EnvironmentDisplay/EnvironmentDisplay.ino,
examples/HeartRateDisplay/HeartRateDisplay.ino,
examples/HeartRateMonitor/HeartRateMonitor.ino,
examples/LEVDisplay/LEVDisplay.ino]
examples/LEVDisplay/LEVDisplay.ino,
examples/MuscleOxygenMonitor/MuscleOxygenMonitor.ino,
examples/ShiftingShifter/ShiftingShifter.ino]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -83,6 +87,9 @@ jobs:
python -m pip install --upgrade pip
pip install --upgrade platformio

- name: Install platform
run: pio platform install native

- name: Install library dependencies
run: pio lib -g install ANT

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
.piolibdeps
.ycm*
*.swp
*.DS_Store

# used for testing
src/main.cpp

.DS_Store
.tags*
tags
.pio
*-e
230 changes: 230 additions & 0 deletions examples/BicyclePowerDisplay/BicyclePowerDisplay.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
/***********************************
* AntPlus Bicycle Power Display example
*
* Finds a nearby Bike Power Sensor, pairs
* to it and then reads the information
* out via the serial port.
*
* Example built for ESP32
* Note: HardwareSerial required for this controller
*
* Author Andrew Hillier
* based on the work of Curtis Malainey
************************************/
#include <Arduino.h>
#include "ANT.h"
#include "ANTPLUS.h"
#include <HardwareSerial.h>

#define BAUD_RATE 9600
#define CHANNEL_0 0
#define antSerial Serial2

const uint8_t NETWORK_KEY[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77}; // get this from thisisant.com

// *************************************
// Specific to test ANT+ chip and ESP32 setup
const int RTS_PIN = 23;
const int SUSPEND_PIN = 22;
const int SLEEP_PIN = 19;
const int RESET_PIN = 2;

// *************************************

ArduinoSerialAntWithCallbacks ant;
AntPlusRouter router;
ProfileBicyclePowerDisplay bikePower;

void bicyclePowerBaseDataPageHandler(AntRxDataResponse& msg, uintptr_t data);
void batteryStatusDataPageHandler(BatteryStatus& msg, uintptr_t data);
void manufacturerIDDataPageHandler(ManufacturersInformation& msg, uintptr_t data);
void productIDDataPageHandler(ProductInformation& msg, uintptr_t data);
void powerOnlyDataPageHandler(BicyclePowerStandardPowerOnly& msg, uintptr_t data);
void crankTorqueDataPageHandler(BicyclePowerStandardCrankTorque& msg, uintptr_t data);
void wheelTorqueDataPageHandler(BicyclePowerStandardWheelTorque& msg, uintptr_t data);
void pedalSmoothnessDataPageHandler(BicyclePowerTorqueEffectivenessAndPedalSmoothness& msg, uintptr_t data);

void bicyclePowerBatteryStatus(uint8_t flags);
void printStatus(uint8_t status);

void setup() {

// Powering on the ANT+ chip
// *************************************

pinMode(SUSPEND_PIN, OUTPUT);
pinMode(SLEEP_PIN, OUTPUT);
pinMode(RESET_PIN, OUTPUT);
pinMode(RTS_PIN, INPUT);

digitalWrite(RESET_PIN, HIGH);
digitalWrite(SUSPEND_PIN, HIGH);
digitalWrite(SLEEP_PIN, LOW);


// *************************************

antSerial.begin(BAUD_RATE);
ant.setSerial(antSerial);
delay(15000);

router.setDriver(&ant); // never touch ant again
router.setAntPlusNetworkKey(NETWORK_KEY);
router.setProfile(CHANNEL_0, &bikePower);
// Delay after initial setup to wait for user to connect on serial

Serial.begin(BAUD_RATE);
Serial.println("Running");
bikePower.onDataPage(bicyclePowerBaseDataPageHandler);
bikePower.onBatteryStatus(batteryStatusDataPageHandler);
bikePower.onManufacturersInformation(manufacturerIDDataPageHandler);
bikePower.onProductInformation(productIDDataPageHandler);
bikePower.onBicyclePowerStandardPowerOnly(powerOnlyDataPageHandler);
bikePower.onBicyclePowerStandardCrankTorque(crankTorqueDataPageHandler);
bikePower.onBicyclePowerStandardWheelTorque(wheelTorqueDataPageHandler);
bikePower.onBicyclePowerTorqueEffectivenessAndPedalSmoothness(pedalSmoothnessDataPageHandler);
bikePower.begin();
// wait for pair to complete
uint8_t status = bikePower.waitForPair();
// print channel status
Serial.println("===========================");
printStatus(status);
Serial.print("Device Number: ");
Serial.println(bikePower.getDeviceNumber());
Serial.print("Transmisison Type: ");
Serial.println(bikePower.getTransmissionType());
}

void loop() {
router.loop();
}

void batteryStatusDataPageHandler(BatteryStatus& msg, uintptr_t data) {
Serial.print("Fractional Battery Voltage: ");
Serial.println(msg.getFractionalBatteryVoltage());
Serial.print("Battery Status: ");
bicyclePowerBatteryStatus(msg.getBatteryStatus());
}

void manufacturerIDDataPageHandler(ManufacturersInformation& msg, uintptr_t data) {
Serial.print("Hardware ID: ");
Serial.println(msg.getHWRevision());
Serial.print("Manufacturer ID: ");
Serial.println(msg.getManufacturerID());
Serial.print("Model Number: ");
Serial.println(msg.getModelNumber());
}

void productIDDataPageHandler(ProductInformation& msg, uintptr_t data) {
Serial.print("Software Version Supplemental: ");
Serial.println(msg.getSWRevisionSupplemental());
Serial.print("Software Version: ");
Serial.println(msg.getSWRevisionMain());
Serial.print("Serial Number: ");
Serial.println(msg.getSerialNumber());
}

void bicyclePowerBaseDataPageHandler(AntRxDataResponse& msg, uintptr_t data) {
BicyclePowerBaseMainDataPage dp = BicyclePowerBaseMainDataPage(msg);
Serial.println("===========================");
Serial.print("DataPage: ");
Serial.println(dp.getDataPageNumber());
Serial.print("Bike Power Event Count: ");
Serial.println(dp.getUpdateEventCount());
}

void powerOnlyDataPageHandler(BicyclePowerStandardPowerOnly& msg, uintptr_t data) {
Serial.print("Pedal Power: ");
if (msg.getPedalPower() == ANTPLUS_BICYCLEPOWER_DATAPAGES_STANDARDPOWERONLY_PEDALPOWER_NOTUSED) {
Serial.println("Not Used");
} else {
Serial.println(msg.getPedalPower());
}
Serial.print("Instantaneous Cadence: ");
if (msg.getInstantaneousCadence() == ANTPLUS_BICYCLEPOWER_DATAPAGES_STANDARDPOWERONLY_INSTANTANEOUSCADENCE_INVALID) {
Serial.println("Invalid");
} else {
Serial.println(msg.getInstantaneousCadence());
}
Serial.print("Accumulated Power: ");
Serial.println(msg.getAccumulatedPower());
Serial.print("Instantaneous Power: ");
Serial.println(msg.getInstantaneousPower());
}

void crankTorqueDataPageHandler(BicyclePowerStandardCrankTorque& msg, uintptr_t data) {
Serial.print("Crank Ticks: ");
Serial.println(msg.getCrankTicks());
Serial.print("Instantaneous Cadence: ");
Serial.println(msg.getInstantaneousCadence());
Serial.print("Crank Period: ");
Serial.println(msg.getCrankPeriod());
Serial.print("Accumulated Torque: ");
Serial.println(msg.getAccumulatedTorque());
}

void wheelTorqueDataPageHandler(BicyclePowerStandardWheelTorque& msg, uintptr_t data) {
Serial.print("Wheel Ticks: ");
Serial.println(msg.getWheelTicks());
Serial.print("Instantaneous Cadence: ");
Serial.println(msg.getInstantaneousCadence());
Serial.print("Wheel Period: ");
Serial.println(msg.getWheelPeriod());
Serial.print("Accumulated Torque: ");
Serial.println(msg.getAccumulatedTorque());
}

void pedalSmoothnessDataPageHandler(BicyclePowerTorqueEffectivenessAndPedalSmoothness& msg, uintptr_t data) {
Serial.print("Left Torque Effectiveness: ");
Serial.println(msg.getLeftTorqueEffectiveness());
Serial.print("Right Torque Effectiveness: ");
Serial.println(msg.getRightTorqueEffectiveness());
Serial.print("Left Pedal Smoothness: ");
Serial.println(msg.getLeftPedalSmoothness());
Serial.print("Right Pedal Smoothness: ");
Serial.println(msg.getRightPedalSmoothness());
}

void printStatus(uint8_t status) {
Serial.print("Channel Status: ");
switch (status) {
case CHANNEL_STATUS_UNASSIGNED:
Serial.println("Unassigned");
break;
case CHANNEL_STATUS_ASSIGNED:
Serial.println("Assigned");
break;
case CHANNEL_STATUS_SEARCHING:
Serial.println("Searching");
break;
case CHANNEL_STATUS_TRACKING:
Serial.println("Tracking");
break;
}
}

void bicyclePowerBatteryStatus(uint8_t flags) {
switch (flags) {
case ANTPLUS_COMMON_DATAPAGE_BATTERYSTATUS_BATTERYSTATUS_NEW:
Serial.println("New");
break;
case ANTPLUS_COMMON_DATAPAGE_BATTERYSTATUS_BATTERYSTATUS_GOOD:
Serial.println("Good");
break;
case ANTPLUS_COMMON_DATAPAGE_BATTERYSTATUS_BATTERYSTATUS_OK:
Serial.println("Ok");
break;
case ANTPLUS_COMMON_DATAPAGE_BATTERYSTATUS_BATTERYSTATUS_LOW:
Serial.println("Low");
break;
case ANTPLUS_COMMON_DATAPAGE_BATTERYSTATUS_BATTERYSTATUS_CRITICAL:
Serial.println("Critical");
break;
case ANTPLUS_COMMON_DATAPAGE_BATTERYSTATUS_BATTERYSTATUS_INVALID:
Serial.println("Invalid");
break;
default:
Serial.println("Reserved/Unknown");
break;
}
}
Loading