-
Notifications
You must be signed in to change notification settings - Fork 1
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
Vcoman/ces demo #14
base: master
Are you sure you want to change the base?
Vcoman/ces demo #14
Conversation
Signed-off-by: Victor Coman <[email protected]>
Signed-off-by: Victor Coman <[email protected]>
Signed-off-by: Victor Coman <[email protected]>
… each time the application is restarted Signed-off-by: Victor Coman <[email protected]>
-before it gave an exception, now it returns true Signed-off-by: Victor Coman <[email protected]>
return get_next_random(wind, WIND_MAX, WIND_MIN, WIND_DELTA) | ||
else: | ||
# Conversion from miles/h to km/h | ||
return round(wind * 1.609, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more elegant to have a separated function to convert to km/h and call it here.
wind_dir = meas_items["current_windDirection_List"] | ||
luminosity = meas_items["lightVal"] | ||
|
||
# meas_data = [temp, moist, pres, rain, wind, wind_dir, luminosity] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these comments
@@ -1200,7 +1409,11 @@ def main(): | |||
# Start a task to get the status from the irrigation stations. | |||
status_task() | |||
|
|||
# TODO: Remove for final version as main controller is set in the provisioning step. | |||
set_main_controller(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be removed, then?
|
||
while True: | ||
start_time = time.time() | ||
|
||
# Reset the rain at midnight. | ||
if (current_time + time_factor) // SECONDS_PER_DAY > 0: | ||
# Create and configure the serial port settings | ||
ser = serial.Serial() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this instantiation conflict with the port created in the read_microbit()
method? Maybe we should declare the serial port as global and use it in both methods.
@@ -1165,6 +1405,22 @@ def main(): | |||
|
|||
global device, current_time | |||
|
|||
# Create and configure the serial port settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated block of code, it would be better to have a method that resets the microbit board.
No description provided.