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

Commit 7014fb3

Browse files
committed
Pybytes bugfixes
1 parent 4201b30 commit 7014fb3

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

esp32/frozen/Pybytes/_main.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -45,55 +45,55 @@
4545
if 'pybytes' not in globals().keys():
4646
pybytes = Pybytes(pybytes_config, pybytes_config.get('cfg_msg') is None, True)
4747

48-
# Please put your USER code below this line
48+
# Please put your USER code below this line
4949

50-
# SEND SIGNAL
51-
# You can currently send Strings, Int32, Float32 and Tuples to pybytes using this method.
52-
# pybytes.send_signal(signalNumber, value)
50+
# SEND SIGNAL
51+
# You can currently send Strings, Int32, Float32 and Tuples to pybytes using this method.
52+
# pybytes.send_signal(signalNumber, value)
5353

54-
# SEND SENSOR DATA THROUGH SIGNALS
55-
# # If you use a Pysense, some libraries are necessary to access its sensors
56-
# # you can find them here: https://github.com/pycom/pycom-libraries
57-
#
58-
# # Include the libraries in the lib folder then import the ones you want to use here:
59-
# from SI7006A20 import SI7006A20
60-
# si = SI7006A20()
61-
# from LTR329ALS01 import LTR329ALS01
62-
# ltr = LTR329ALS01()
63-
#
64-
# # Import what is necessary to create a thread
65-
# import _thread
66-
# from time import sleep
67-
# from machine import Pin
68-
#
69-
# # Define your thread's behaviour, here it's a loop sending sensors data every 10 seconds
70-
# def send_env_data():
71-
# while (pybytes):
72-
# pybytes.send_signal(1, si.humidity())
73-
# pybytes.send_signal(2, si.temperature())
74-
# pybytes.send_signal(3, ltr.light());
75-
# sleep(10)
76-
#
77-
# # Start your thread
78-
# _thread.start_new_thread(send_env_data, ())
54+
# SEND SENSOR DATA THROUGH SIGNALS
55+
# # If you use a Pysense, some libraries are necessary to access its sensors
56+
# # you can find them here: https://github.com/pycom/pycom-libraries
57+
#
58+
# # Include the libraries in the lib folder then import the ones you want to use here:
59+
# from SI7006A20 import SI7006A20
60+
# si = SI7006A20()
61+
# from LTR329ALS01 import LTR329ALS01
62+
# ltr = LTR329ALS01()
63+
#
64+
# # Import what is necessary to create a thread
65+
# import _thread
66+
# from time import sleep
67+
# from machine import Pin
68+
#
69+
# # Define your thread's behaviour, here it's a loop sending sensors data every 10 seconds
70+
# def send_env_data():
71+
# while (pybytes):
72+
# pybytes.send_signal(1, si.humidity())
73+
# pybytes.send_signal(2, si.temperature())
74+
# pybytes.send_signal(3, ltr.light());
75+
# sleep(10)
76+
#
77+
# # Start your thread
78+
# _thread.start_new_thread(send_env_data, ())
7979

80-
# SET THE BATTERY LEVEL
81-
# pybytes.send_battery_level(23)
80+
# SET THE BATTERY LEVEL
81+
# pybytes.send_battery_level(23)
8282

83-
# SEND DIGITAL VALUE
84-
# pybytes.send_digital_pin_value(False, 12, Pin.PULL_UP)
83+
# SEND DIGITAL VALUE
84+
# pybytes.send_digital_pin_value(False, 12, Pin.PULL_UP)
8585

86-
# SEND ANALOG VALUE
87-
# pybytes.send_analog_pin_value(False, 13)
86+
# SEND ANALOG VALUE
87+
# pybytes.send_analog_pin_value(False, 13)
8888

89-
# REGISTER PERIODICAL DIGIAL VALUE SEND
90-
# pybytes.register_periodical_digital_pin_publish(False, PIN_NUMBER, Pin.PULL_UP, INTERVAL_SECONDS)
89+
# REGISTER PERIODICAL DIGIAL VALUE SEND
90+
# pybytes.register_periodical_digital_pin_publish(False, PIN_NUMBER, Pin.PULL_UP, INTERVAL_SECONDS)
9191

92-
# REGISTER PERIODICAL ANALOG VALUE SEND
93-
# pybytes.register_periodical_analog_pin_publish(False, PIN_NUMBER, INTERVAL_SECONDS)
92+
# REGISTER PERIODICAL ANALOG VALUE SEND
93+
# pybytes.register_periodical_analog_pin_publish(False, PIN_NUMBER, INTERVAL_SECONDS)
9494

95-
# CUSTOM METHOD EXAMPLE
96-
# def custom_print(params):
97-
# print("Custom method called")
98-
# return [255, 20]
99-
# pybytes.add_custom_method(0, custom_print)
95+
# CUSTOM METHOD EXAMPLE
96+
# def custom_print(params):
97+
# print("Custom method called")
98+
# return [255, 20]
99+
# pybytes.add_custom_method(0, custom_print)

esp32/frozen/Pybytes/_pybytes_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def read_config(self, filename='/flash/pybytes_config.json'):
442442
# Check if we have a project specific configuration
443443
try:
444444
pf = open('/flash/pybytes_project.json', 'r')
445-
pjfile = pf.readall()
445+
pjfile = pf.read()
446446
pf.close()
447447
try:
448448
import json
@@ -456,7 +456,7 @@ def read_config(self, filename='/flash/pybytes_config.json'):
456456
print("Exception: {}".format(ex))
457457
except:
458458
pass
459-
460-
self.__pybytes_config['pybytes_autostart'] = self.__check_config()
459+
if self.__pybytes_config.get('pybytes_autostart', False):
460+
self.__pybytes_config['pybytes_autostart'] = self.__check_config()
461461

462462
return self.__pybytes_config

0 commit comments

Comments
 (0)