Skip to content

Setup.state as u8 and shorter keys #101

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

Merged
merged 5 commits into from
Jul 25, 2017
Merged

Setup.state as u8 and shorter keys #101

merged 5 commits into from
Jul 25, 2017

Conversation

renzenicolai
Copy link
Member

No description provided.

@renzenicolai renzenicolai changed the base branch from esp32 to master July 23, 2017 11:19
@basvs basvs self-requested a review July 23, 2017 11:25
@@ -11,7 +11,7 @@ def store_settings(nickname):

def is_developer(nickname):
if (nickname==""):
badge.nvs_set_str('badge', 'setup.state', '2') # Skip the sponsors
badge.nvs_set_u8('badge', 'setup.state', 2) # Skip the sponsors
Copy link

Choose a reason for hiding this comment

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

If we change the type of 'setup.state', we should support backward compatibility / conversion of old values.

Copy link

@basvs basvs left a comment

Choose a reason for hiding this comment

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

we cannot just change the type of a nvs key without any conversion-code.

@basvs basvs force-pushed the setup.state_as_u8 branch from 4d43b9b to 3acf9be Compare July 23, 2017 11:34
@basvs
Copy link

basvs commented Jul 23, 2017

badge.nvs_set_str('badge', 'setup.state', '2')

badge.nvs_get_str('badge', 'setup.state')

'2'

badge.nvs_get_u8('badge', 'setup.state')

(empty response; "not set")

badge.nvs_set_u8('badge', 'setup.state', 2)

badge.nvs_get_u8('badge', 'setup.state')

(empty response; "not set")

badge.nvs_get_str('badge', 'setup.state')

'2'

We're not ready for type conversion yet. Working on it..

@basvs
Copy link

basvs commented Jul 23, 2017

Fixed master-branch.

When setting a key, you can now change the key type.

badge.nvs_set_str('badge', 'something', '42')
badge.nvs_get_str('badge', 'something') -> '42'
badge.nvs_get_u8('badge', 'something') -> null

badge.nvs_set_u8('badge', 'something', 42)
badge.nvs_get_str('badge', 'something') -> null
badge.nvs_get_u8('badge', 'something') -> 42

You do not need an explicit nvs_erase_key.

@annejan
Copy link
Member

annejan commented Jul 25, 2017

@basvs since we are re-flashing all . .
I think we can merge :)

@basvs
Copy link

basvs commented Jul 25, 2017

agreed

@annejan annejan merged commit 0e89e70 into master Jul 25, 2017
@basvs basvs deleted the setup.state_as_u8 branch June 24, 2018 14:45
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

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy