Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes not shifting after powertable has been deleted (without Cadence) #603

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Hardware


## [24.12.7]

### Added

### Changed
- Fixes homing not being removed after powertable reset.
- Shifting will always abort homing, even if homing hasn't been preformed yet.

### Hardware

## [24.11.25]

### Added
Expand Down
8 changes: 5 additions & 3 deletions src/ERG_Mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ void PowerTable::runERG() {
}

if (ss2k->resetPowerTableFlag) {
LittleFS.remove(POWER_TABLE_FILENAME);
powerTable->reset();
userConfig->setHMin(INT32_MIN);
userConfig->setHMax(INT32_MIN);
spinBLEServer.spinDownFlag = 0;
rtConfig->setHomed(false);
userConfig->saveToLittleFS();
}
Expand Down Expand Up @@ -873,7 +875,7 @@ bool PowerTable::_manageSaveState() {

// If both current and saved tables were created with homing, we can skip position reliability checks
bool canSkipReliabilityChecks = savedHomed && rtConfig->getHomed();

if (!canSkipReliabilityChecks) {
// Initialize a counter for reliable positions
int reliablePositions = 0;
Expand Down Expand Up @@ -914,7 +916,7 @@ bool PowerTable::_manageSaveState() {
file.read((uint8_t*)&version, sizeof(version));
file.read((uint8_t*)&savedQuality, sizeof(savedQuality));
file.read((uint8_t*)&savedHomed, sizeof(savedHomed));

float averageOffset = 0;
if (!canSkipReliabilityChecks) {
std::vector<float> offsetDifferences;
Expand Down Expand Up @@ -966,7 +968,7 @@ bool PowerTable::_manageSaveState() {
}
SS2K_LOG(POWERTABLE_LOG_TAG, "Power Table loaded with an offset of %d.", averageOffset);
}

// set the flag so it isn't loaded again this session.
this->_hasBeenLoadedThisSession = true;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ void IRAM_ATTR SS2K::shiftUp() { // Handle the shift up interrupt IRAM_ATTR is
if (ss2k->deBounce()) {
if (!digitalRead(currentBoard.shiftUpPin)) { // double checking to make sure the interrupt wasn't triggered by emf
rtConfig->setShifterPosition(rtConfig->getShifterPosition() - 1 + userConfig->getShifterDir() * 2);
// Stop homing initiation
spinBLEServer.spinDownFlag = 0;
} else {
ss2k->lastDebounceTime = 0;
} // Probably Triggered by EMF, reset the debounce
Expand All @@ -510,6 +512,8 @@ void IRAM_ATTR SS2K::shiftDown() { // Handle the shift down interrupt
if (ss2k->deBounce()) {
if (!digitalRead(currentBoard.shiftDownPin)) { // double checking to make sure the interrupt wasn't triggered by emf
rtConfig->setShifterPosition(rtConfig->getShifterPosition() + 1 - userConfig->getShifterDir() * 2);
// Stop homing initiation
spinBLEServer.spinDownFlag = 0;
} else {
ss2k->lastDebounceTime = 0;
} // Probably Triggered by EMF, reset the debounce
Expand Down
Loading