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

Enable erase_chip by default #3701

Merged
merged 4 commits into from
Jan 5, 2024
Merged

Conversation

haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Dec 28, 2023

When migrating from previous version this settings was reported to disabled by default.

@haslinghuis haslinghuis added this to the 10.10.0 milestone Dec 28, 2023
@haslinghuis haslinghuis self-assigned this Dec 28, 2023

This comment has been minimized.

This comment has been minimized.

@blckmn
Copy link
Member

blckmn commented Dec 28, 2023

AUTOMERGE: (FAIL)

  • github identifies PR as mergeable -> FAIL
  • assigned to a milestone -> PASS
  • cooling off period lapsed -> PASS
  • commit count less or equal to three -> FAIL
  • Don't merge label NOT found -> PASS
  • at least one RN: label found -> PASS
  • Tested label found -> FAIL
  • assigned to an approver -> PASS
  • approver count at least three -> FAIL

@haslinghuis haslinghuis marked this pull request as draft December 28, 2023 02:38
@haslinghuis haslinghuis force-pushed the fix-erase-chip branch 2 times, most recently from c7d7531 to 4659b30 Compare December 29, 2023 02:05

This comment has been minimized.

Comment on lines 578 to 582
if (result.erase_chip) {
if (result.erase_chip === undefined) {
$('input.erase_chip').prop('checked', true);
} else {
$('input.erase_chip').prop('checked', false);
$('input.erase_chip').prop('checked', result.erase_chip);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is better to "overcharge" the getConfig() method with this code, adding a second "optional" parameter as "default". If configured, and undefined, then return the default. In this way we can do the same for others parameters if we want. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, its a better option, but then we have to change them all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all? If the parameter is optional, we don't need to change others.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a shot at it. Please have a look again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me 😉 thanks!

This comment has been minimized.

@haslinghuis haslinghuis changed the title Set erase_chip as default option when not set before Enable erase_chip by default Dec 29, 2023

This comment has been minimized.

@haslinghuis haslinghuis marked this pull request as ready for review December 29, 2023 16:32

This comment has been minimized.

@haslinghuis haslinghuis deleted the fix-erase-chip branch December 30, 2023 23:31
@haslinghuis haslinghuis restored the fix-erase-chip branch January 2, 2024 18:40
@haslinghuis haslinghuis reopened this Jan 2, 2024

This comment has been minimized.

@haslinghuis haslinghuis force-pushed the fix-erase-chip branch 2 times, most recently from ba15112 to ddeb8a1 Compare January 2, 2024 19:05

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@ctzsnooze
Copy link
Member

ctzsnooze commented Jan 4, 2024

Can I confirm the expected behaviour after this PR is as follows:

  • if Full Chip Erase was active when entering the Flashing tab, nothing changes.
  • if Full Chip Erase was not active when the Flashing tab was opened, it is changed to active, every time we enter the Flashing Tab?
  • if Full Chip Erase was not active when the Flashing tab was opened, and was automatically changed to active, the user can only only be reverted it to not active by clicking the switch to off?
  • If the user has set Full Chip Erase to off, and exits the Flashing tab, does something else in some other tab, and then returns to the Flashing tab, it will remain off?
  • If the user has set Full Chip Erase to off, and quits Configurator, then re-opens and goes to the Flashing tab, it will show Full Chip Erase as being on?

In the fourth possibility, that a user turns Full Chip Erase off, goes to some other tab, and comes back to the Flashing tab, I guess it is best for Full Chip Erase to stay off.

@haslinghuis
Copy link
Member Author

In the fourth possibility, that a user turns Full Chip Erase off, goes to some other tab, and comes back to the Flashing tab, I guess it is best for Full Chip Erase to stay off.

That behavior was covered by the first commit.

@nerdCopter
Copy link
Member

nerdCopter commented Jan 4, 2024

tested 4c5a914f:

  • 1 = yes, remains active
  • 2 = yes, reverts to active
  • 3 = yes, can only manually disable
  • 4 = no, returns to enabled
  • 5 = yes, reverts enabled

further findings. seems flashing significantly disparate firmware version, it will still erase chip even if disabled.
i've seen this in the far past and did not comment such.
for example when disabling erase, flashing master to master works as expect, master to PR 13248 will work as expected, but some older PR like 13234 will full-chip erase.

edit: this may be a factor of some PG change affecting the entire eeprom.

@haslinghuis
Copy link
Member Author

haslinghuis commented Jan 4, 2024

If the user has set Full Chip Erase to off, and exits the Flashing tab, does something else in some other tab, and then returns to the Flashing tab, it will remain off?

In the fourth possibility, that a user turns Full Chip Erase off, goes to some other tab, and comes back to the Flashing tab, I guess it is best for Full Chip Erase to stay off.

To cover point 4 - setting default enabled value in main.js instead of in firmware flasher tab would allow for session wide behavior.

@nerdCopter
Copy link
Member

To cover point 4 - setting default enabled value in main.js instead of in firmware flasher tab would allow for session wide behavior.

i am okay with current behavior. unsure what others desire.

This comment has been minimized.

Copy link

sonarcloud bot commented Jan 4, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

github-actions bot commented Jan 4, 2024

Do you want to test this code? Here you have an automated build:
Betaflight-Configurator-Android
Betaflight-Configurator-Linux
Betaflight-Configurator-macOS
Betaflight-Configurator-Windows
WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

@blckmn blckmn merged commit cde3019 into betaflight:master Jan 5, 2024
8 checks passed
@haslinghuis haslinghuis deleted the fix-erase-chip branch January 5, 2024 08:57
chmelevskij pushed a commit to chmelevskij/betaflight-configurator that referenced this pull request Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

5 participants