Skip to content

Commit

Permalink
examples: fec: add missing prints
Browse files Browse the repository at this point in the history
also fix some formatting errors and remove debug prints
  • Loading branch information
cujomalainey committed Jan 30, 2022
1 parent 18d662c commit ae89b84
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions examples/FecBikeTrainerDisplay/FecBikeTrainerDisplay.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void setup() {
fec.onManufacturersInformation(manufacturerInformationDataPageHandler);
fec.onProductInformation(productInformationDataPageHandler);
fec.onFecGeneralFeData(GeneralDataPageHandler);
//fec.onFecGeneralSettingsDataPage(GeneralSettingsDataPageHandler);
fec.onFecGeneralSettingsPage(GeneralSettingsDataPageHandler);
fec.onFecTrainerData(SpecificTrainerDataPageHandler);
fec.onFecFeCapabilities(FeCapabitiliesDataPageHandler);

Expand Down Expand Up @@ -104,12 +104,11 @@ void loop() {
FecTargetPowerMsg tp;
tp.setTargetPower(TargetPower);
fec.send(tp);
Serial.println(TargetPower);
}
}

void printFeState(uint8_t fe_state) {
Serial.print("FE State:");
Serial.print("FE State: ");
switch (fe_state) {
case ANTPLUS_FEC_DATAPAGE_FESTATE_RESERVED:
Serial.println("Reserved");
Expand Down Expand Up @@ -205,7 +204,26 @@ void GeneralDataPageHandler(FecGeneralFeData& msg, uintptr_t data) {
} else {
Serial.println(hr);
}

Serial.print("HR Data Source: ");
uint8_t source = msg.getHrDataSource();
switch (source) {
case ANTPLUS_FEC_DATAPAGE_GENERALFEDATA_HRDATASOURCE_INVALID:
Serial.println("Invalid");
break;
case ANTPLUS_FEC_DATAPAGE_GENERALFEDATA_HRDATASOURCE_ANTPLUSMONITOR:
Serial.println("ANT+ HR Monitor");
break;
case ANTPLUS_FEC_DATAPAGE_GENERALFEDATA_HRDATASOURCE_EMMONITOR:
Serial.println("EM Monitor");
break;
case ANTPLUS_FEC_DATAPAGE_GENERALFEDATA_HRDATASOURCE_HANDSCONTACT:
Serial.println("Hand Contact");
break;
}
Serial.print("Distance Traveled Enabled: ");
Serial.println(msg.getDistanceTraveledEnabled());
Serial.print("Virtual Speed Flag: ");
Serial.println(msg.getVirtualSpeedFlag());
printFeState(msg.getFeState());
printLapToggleBit(msg.getLapToggleBit());
}
Expand Down Expand Up @@ -258,10 +276,10 @@ void SpecificTrainerDataPageHandler(FecSpecificTrainerData& msg, uintptr_t data)
Serial.println("Accumulated Power: Invalid");
Serial.println("Instantaneous Power: Invalid");
} else {
Serial.println("Accumulated Power: ");
Serial.print(msg.getAccumulatedPower());
Serial.println("Instantaneous Power: ");
Serial.print(power);
Serial.print("Accumulated Power: ");
Serial.println(msg.getAccumulatedPower());
Serial.print("Instantaneous Power: ");
Serial.println(power);
}
Serial.print("Bicycle Power Calibration: ");
if (msg.getBicyclePowerCalibration())
Expand Down Expand Up @@ -311,7 +329,7 @@ void SpecificTrainerDataPageHandler(FecSpecificTrainerData& msg, uintptr_t data)
void FeCapabitiliesDataPageHandler(FecFeCapabilities& msg, uintptr_t data) {
Serial.print("Max resistance: ");
Serial.println(msg.getMaximumResistance());
Serial.print("Fec Capabilities: ");
Serial.println("Fec Capabilities: ");
Serial.print(" Supports Basic Resistance Mode: ");
Serial.println(msg.getBasicResistanceModeSupport() ? "Y" : "N");
Serial.print(" Supports Target Power Mode: ");
Expand Down

0 comments on commit ae89b84

Please sign in to comment.