Skip to content

Commit

Permalink
Merge pull request #593 from doudar/PowerTable_Import_Fix
Browse files Browse the repository at this point in the history
- PowerTable Import via Custom Characteristic fixed.
  • Loading branch information
doudar authored Nov 25, 2024
2 parents bd11ae6 + df5b252 commit a29a550
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Multiple Homing refinements.
- Working with resistance mode on QZ & Peloton
- PowerTable Import via Custom Characteristic fixed.
- Check for cadence (before homing) so that we don't home when nobody is around.
- Don't depower the stepper if there is cadence.

Expand Down
9 changes: 5 additions & 4 deletions src/BLE_Custom_Characteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,12 +670,13 @@ void BLE_ss2kCustomCharacteristic::process(std::string rxValue) {
}
if (rxValue[0] == cc_write) {
returnValue[0] = cc_success;
if (rxValue[3]) {
for (int i = 0; i < POWERTABLE_WATT_SIZE; i += 2) {
powerTable->tableRow[rxValue[3]].tableEntry[i].targetPosition = (int16_t((uint8_t)(rxValue[i + 3]) << 0 | (uint8_t)(rxValue[i + 4]) << 8));
if (rxValue[2] >= 0 || rxValue[2] < POWERTABLE_CAD_SIZE) {
for (int i = 0; i < POWERTABLE_WATT_SIZE; i++) {
powerTable->tableRow[rxValue[2]].tableEntry[i].targetPosition = (int16_t((uint8_t)(rxValue[i*2 + 3]) << 0 | (uint8_t)(rxValue[i*2 + 4]) << 8));
}
} else {
SS2K_LOG(CUSTOM_CHAR_LOG_TAG, "No table row specified");
//SS2K_LOG(CUSTOM_CHAR_LOG_TAG, "Table row invalid");
// Logging causes crashes in ISR
}
}
break;
Expand Down

0 comments on commit a29a550

Please sign in to comment.