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

feat: support arbitrary APPNAME and correct GPIOs #69

Merged
merged 3 commits into from
Sep 9, 2021

Conversation

marvinmarnold
Copy link
Contributor

@marvinmarnold marvinmarnold commented Aug 24, 2021

Why
When advertising, we pull the APPNAME parameter from the variant definitions file. However, some of the variants (non-Nebra and DIY) do not have an APPNAME which causes this to fail.

Also, different variants use different GPIOs, which need to be correctly used.

How

  • renamed test file for consistency with underlying class
  • added hardware definitions dependency and load it in app
  • updated naming logic based on variant details
  • get rid of isIndoorVariant helper
  • add Mock.GPIO test dependency
  • fix an unrelated issue with setting miner_keys when they are
    malformed, discovered during testing.
  • having difficulty testing gatewayconfig_app because state is
    not being properly cleared between tests

References
Closes #56
Closes #58

Closes #56

- renamed test file for consistency with underlying class
- added hardware definitions dependency and load it in app
- updated naming logic based on variant details
@marvinmarnold marvinmarnold requested a review from a team as a code owner August 24, 2021 21:19
@shawaj shawaj mentioned this pull request Aug 24, 2021
@shawaj
Copy link
Member

shawaj commented Aug 25, 2021

Working well on a RAK based hotspot and light Hotspot

Check small-smoke on helium-light-test

- get rid of isIndoorVariant helper
- add Mock.GPIO test dependency
- fix an unrelated issue with setting miner_keys when they are
malformed, discovered during testing.
- having difficulty testing gatewayconfig_app because state is
not being properly cleared between tests
@marvinmarnold marvinmarnold changed the title feat(advertisement): support arbitrary APPNAME feat: support arbitrary APPNAME and correct GPIOs Aug 25, 2021
status_led_gpio = OTHER_STATUS_LED_GPIO

self.user_button = Button(user_button_gpio, hold_time=USER_BUTTON_HOLD_SECONDS)
self.user_button = Button(self.get_button_pin(), hold_time=USER_BUTTON_HOLD_SECONDS)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_button_pin created to make unit testing easier

@@ -60,7 +62,7 @@ def stop(self):
logger.debug("Stopping ConfigApp")
GPIO.cleanup()
# Quits the cputemp application
self.bluetooth_processor.quit()
self.bluetooth_services_processor.quit()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an unrelated bug discovered during unit testing

@@ -35,7 +35,10 @@ def read_miner_keys(miner_keys_filepath):
for key in json_line.keys():
miner_keys[key] = json_line[key]
except json.JSONDecodeError:
miner_keys[key] = False
logger.error("Unable to correctly decode miner_keys. The app will continue running but may not behave as expected.")
miner_keys['pubkey'] = False
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should talk about this behavior more. The current logic will allow the application to start-up if the miner_keys file exists, even if it is malformed. Later on the app will choke when it tries to use those keys. Should we instead exit immediately when malformed JSON? Exponential backoff?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure. In one sense it would be better for it not to work.

However from a customers perspective it would be better for it to show a (useful) error on the app IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #80 to follow-up with this.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@marvinmarnold
Copy link
Contributor Author

@vpetersson can we merge this?

Copy link
Contributor

@vpetersson vpetersson left a comment

Choose a reason for hiding this comment

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

I've only read over it and it looks reasonable. Needs to be tested on TestNet.

@shawaj shawaj merged commit 8c9729e into master Sep 9, 2021
@shawaj shawaj deleted the marvinmarnold/56/support-arbitrary-appname branch September 9, 2021 17:10
@shawaj
Copy link
Member

shawaj commented Sep 9, 2021

@vpetersson @marvinmarnold pushed to testnet for testing NebraLtd/helium-miner-software@2ef36bd

@shawaj
Copy link
Member

shawaj commented Sep 10, 2021

Seems to be working fine for me

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.

Correct outdoor GPIOs Support for non-Nebra APPNAME
3 participants