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

eeprom written to twice when manual scanning #117

Closed
prokrypt opened this issue May 25, 2024 · 10 comments
Closed

eeprom written to twice when manual scanning #117

prokrypt opened this issue May 25, 2024 · 10 comments

Comments

@prokrypt
Copy link

prokrypt commented May 25, 2024

When scrolling/scanning through channels/frequencies, the eeprom is written to upon UP/DOWN buttonpress (when it initially switches to another channel/frequency), then it scans as normal while holding down the button. Then upon button release when it lands on the final channel/frequency, the eeprom is written to again. This happens on both memory mode and vfo, as well as FM broadcast mode. This bug doesn't exist in egzumer's firmware (I think), so maybe something was changed/removed/broken with bKeyHeld.

@armel
Copy link
Owner

armel commented May 25, 2024

My firmware is more than 200 commits ahead of egzumer v0.22, so there are a lot of changes. For example, about the scan, since v2.4, a LONG press on MENU key, in * SCAN mode (List I or List II) temporarily exclude a memory channel (not working with * SCAN ALL). This may be the reason for this change...

@prokrypt
Copy link
Author

prokrypt commented May 25, 2024

Oops sorry about that, false alert. I looked through the code and it seems it may have been present in egzumer's fw too. I tried my hand at fixing it (just simple removal of the bKeyHeld parts because it doesn't seem too reliable, and the code elsewhere still handles it correctly when button is released. I don't know what I'm doing but it seemed to work failed spectacularly (and saves some bytes in the process!): prokrypt@33e9200

Feel free to just copy and paste the relevant bits, as I don't really know how to github 😅

@prokrypt
Copy link
Author

Oops. After a few hours of testing, it looks like I broke some things...

@prokrypt
Copy link
Author

prokrypt commented May 26, 2024

And all the things I broke (direct input of VFO/FM channels don't save until next keypress, VFO frequency no longer changes on single keypress, VFO direct input does nothing) are fixed... at the expense of more bytes used 🫠!
everything here except for line 2021 in app.c: prokrypt@b961386

@prokrypt
Copy link
Author

And after many more hours of testing, it seems like nothing broke this time!
Just && !bKeyPressed added in two places. No more double eeprom writes. Yay.

@prokrypt
Copy link
Author

I noticed I only fixed the memory modes for VFOs and FM. Holding down up/down for frequency scanning still does a double eeprom write. I think I give up 🫠

@prokrypt
Copy link
Author

prokrypt commented Jul 1, 2024

Finally! Found the last problem bit:

if (!bKeyHeld) {

change to if (!bKeyHeld && !bKeyPressed) {
🎉

... along with a few more changes to address new bugs (menu exiting after grequestsavechannel stuff)

@armel
Copy link
Owner

armel commented Jul 8, 2024

There is now this test in your code if ((!bKeyHeld && !bKeyPressed) || UI_MENU_GetCurrentMenuId()) { ?

@prokrypt
Copy link
Author

prokrypt commented Jul 8, 2024

Yes, that prevents the menu from closing when certain settings are changed

Screenshot_20240708-001559

armel added a commit that referenced this issue Jul 8, 2024
@armel
Copy link
Owner

armel commented Jul 8, 2024

Ok, thank you.

@armel armel closed this as completed Jul 8, 2024
armel added a commit that referenced this issue Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants