Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Conversation

@penrods
Copy link
Contributor

@penrods penrods commented May 17, 2017

On the Mark 1 device, there is a sequence of events that produce a guide to the user for getting their device setup and connected to the internet. This process is basically:

  • Enclosure client starts up, sending a message to the Arduino
  • When/if the Arduino responds, it checks for a live internet connection
  • If no connection is found, the user is prompted
    However the speech client was sometimes not fully up, so the request to speak the prompt was sent before it was listening.

Additionally, sometimes events would occur that caused the prompt to connect the unit multiple time in a row. This commit limits the prompts to a max of once every 30 seconds.

Finally, I commented the code and renamed some of the methods to clarify this sequence of events. The code:
Timer(5, self.stop).start()
and:
def stop(self):
if not self.started:
self.writer.stop()
Are some of the most confusing lines of code I've ever seen. :)

Major changes:

  • The messagebus message "enclosure.start" is now "enclosure.started"
  • Enclosure.start() is now Enclosure.on_arduino_responded()
  • Enclosure.started is now Enclosure.arduino_responded
  • Added Enclosure.last_internet_notification to track notification times
  • The notification call to the speech client is now delayed by 5 seconds, providing time for the speech client to come up. (And an additional check is run to verify the connection is still down immediately before the verbal prompt is spoken)

…always occur

On the Mark 1 device, there is a sequence of events that produce a guide to the user for getting their device setup and connected to the internet.  This process is basically:
* Enclosure client starts up, sending a message to the Arduino
* When/if the Arduino responds, it checks for a live internet connection
* If no connection is found, the user is prompted
However the speech client was sometimes not fully up, so the request to speak the prompt was sent before it was listening.

Additionally, sometimes events would occur that caused the prompt to connect the unit multiple time in a row.  This commit limits the prompts to a max of once every 30 seconds.

Finally, I commented the code and renamed some of the methods to clarify this sequence of events.  The code:
   Timer(5, self.stop).start()
and:
   def stop(self):
        if not self.started:
            self.writer.stop()
Are some of the most confusing lines of code I've ever seen.  :)

Major changes:
* The messagebus message "enclosure.start" is now "enclosure.started"
* Enclosure.start() is now Enclosure.on_arduino_responded()
* Enclosure.started is now Enclosure.arduino_responded
* Added Enclosure.last_internet_notification to track notification times
* The notification call to the speech client is now delayed by 5 seconds, providing time for the speech client to come up.  (And an additional check is run to verify the connection is still down immediately before the verbal prompt is spoken)
@penrods penrods requested a review from kfezer May 17, 2017 23:49
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 36.174% when pulling ddc0453 on feature/improved_connection_prompt into 49f40ce on dev.

Copy link
Contributor

@kfezer kfezer left a comment

Choose a reason for hiding this comment

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

This all looks good to me. Nothing else is looking for the ws message 'enclosure.start'

@kfezer kfezer merged commit 8b6067c into dev May 18, 2017
@kfezer kfezer deleted the feature/improved_connection_prompt branch May 18, 2017 00:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants