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

Synch Fork #1

Merged
merged 28 commits into from
May 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e7f173a
Merge pull request #110 from pycom/rc6
peter-pycom Feb 28, 2020
1a12aed
Update pyexec.c
Xykon Mar 2, 2020
e4be1c6
Merge pull request #111 from pycom/forum_topic_5740
Xykon Mar 2, 2020
f92bba0
LTE: add debug flag
peter-pycom Mar 16, 2020
69ac2af
Merge pull request #112 from pycom/lte_debug
peter-pycom Mar 17, 2020
ff53818
Update get_idf_libs.py
Xykon Mar 17, 2020
20cc45c
Merge pull request #113 from pycom/secure_boot_fix_sdkconfig_copy
Xykon Mar 17, 2020
454c76a
add strlen_const() and sprint_binary_u8()
peter-pycom Mar 20, 2020
85007f9
LTE: add PSM Power Saving Mode
peter-pycom Mar 20, 2020
82c17cb
LTE: init() more expressive exceptions
peter-pycom Mar 20, 2020
d85d1f2
LTE: allow lte_debug to be toggled
peter-pycom Mar 20, 2020
0cdc8e8
LTE: psm not possible inppp
peter-pycom Mar 20, 2020
684d948
Merge pull request #114 from pycom/lte_psm_three
peter-pycom Mar 25, 2020
92ffa59
LTE debug: print milliseconds spent
peter-pycom Mar 26, 2020
3764541
lte_disconnect(): give ATH time to complete
peter-pycom Mar 26, 2020
89b5292
lte_disconnect(): wait less
peter-pycom Mar 26, 2020
5b5b0d9
check IDF git hash
peter-pycom Apr 6, 2020
36d934d
make: improve instructions for IDF_HASH mismatch
peter-pycom Apr 8, 2020
0d6c8bb
Merge pull request #117 from pycom/idf_ver_check
peter-pycom Apr 8, 2020
435d6f2
Merge pull request #116 from pycom/lte_misc
peter-pycom Apr 22, 2020
6621135
[pybytes] updated to v1.4.0 (pymesh integration and coap client)
May 4, 2020
9283f1d
Update version number to 1.20.2.rc7
peter-pycom May 4, 2020
f928e5f
Merge pull request #120 from pycom/pyb_1.4.0
peter-pycom May 4, 2020
64cdc1a
Merge pull request #121 from pycom/v1.20.2.rc7
peter-pycom May 4, 2020
325f89c
Merge pull request #122 from pycom/Dev
peter-pycom May 4, 2020
c4948da
Merge pull request #441 from pycom/release_rc7_again
Xykon May 4, 2020
766b304
Update _pybytes.py
Xykon May 4, 2020
6d01270
Merge pull request #442 from pycom/release_hotfix_for_PR441
Xykon May 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion esp32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif

IDF_VERSION=3.3.1
IDF_HASH=d072c55

TARGET ?= boot_app

Expand Down
3 changes: 2 additions & 1 deletion esp32/application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ APP_UTIL_SRC_C = $(addprefix util/,\
timeutils.c \
esp32chipinfo.c \
pycom_general_util.c \
str_utils.c \
)

APP_FATFS_SRC_C = $(addprefix fatfs/src/,\
Expand Down Expand Up @@ -819,7 +820,7 @@ $(OBJ): | $(GEN_PINS_HDR)

# Check Dependencies (IDF version, Frozen code and IDF LIBS)
CHECK_DEP:
$(Q) bash tools/idfVerCheck.sh $(IDF_PATH) "$(IDF_VERSION)"
$(Q) bash tools/idfVerCheck.sh $(IDF_PATH) "$(IDF_HASH)"
$(Q) bash tools/mpy-build-check.sh $(BOARD) $(BTYPE) $(VARIANT)
$(Q) $(PYTHON) check_secure_boot.py --SECURE $(SECURE)
ifeq ($(COPY_IDF_LIB), 1)
Expand Down
15 changes: 9 additions & 6 deletions esp32/frozen/Pybytes/_OTA.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,24 @@ def update_device_network_config(self, fcota, config):
def get_current_version(self):
return os.uname().release

def get_update_manifest(self):
def get_update_manifest(self, fwtype=None, token=None):
current_version = self.get_current_version()
sysname = os.uname().sysname
wmac = hexlify(machine.unique_id()).decode('ascii')
request_template = "manifest.json?current_ver={}&sysname={}&wmac={}&ota_slot={}"
req = request_template.format(current_version, sysname, wmac, hex(pycom.ota_slot()))
if fwtype == 'pymesh':
request_template = "manifest.json?current_ver={}&sysname={}&token={}&ota_slot={}&wmac={}&fwtype={}"
req = request_template.format(current_version, sysname, token, hex(pycom.ota_slot()), wmac.upper(), fwtype)
else:
request_template = "manifest.json?current_ver={}&sysname={}&wmac={}&ota_slot={}"
req = request_template.format(current_version, sysname, wmac, hex(pycom.ota_slot()))
manifest_data = self.get_data(req).decode()
manifest = ujson.loads(manifest_data)
gc.collect()
return manifest

def update(self, customManifest=None):
def update(self, customManifest=None, fwtype=None, token=None):
try:
manifest = self.get_update_manifest() if not customManifest else customManifest
manifest = self.get_update_manifest(fwtype, token) if not customManifest else customManifest
except Exception as e:
print('Error reading the manifest, aborting: {}'.format(e))
return 0
Expand Down Expand Up @@ -240,7 +244,6 @@ def get_data(self, req, dest_path=None, hash=False, firmware=False):
fp = open(dest_path, 'wb')

if firmware:
print('start')
pycom.ota_start()

h = uhashlib.sha1()
Expand Down
36 changes: 36 additions & 0 deletions esp32/frozen/Pybytes/_coap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'''
Copyright (c) 2020, Pycom Limited.
This software is licensed under the GNU GPL version 3 or any
later version, with permitted additional terms. For more information
see the Pycom Licence v1.0 document supplied with this file, or
available at https://www.pycom.io/opensource/licensing
'''

from network import WLAN
from network import Coap
# import uselect
# import _thread
# import machine


class COAPClient():
def __init__(self, target_server, port):
self.__coap_server = target_server
self.__coap_server_port = port

wlan = WLAN(mode=WLAN.STA)
self.__device_ip = wlan.ifconfig()[0]

Coap.init(str(wlan.ifconfig()[0]), service_discovery=False)

def send_coap_message(self, message, method, uri_path, token, include_options=True):
message_id = Coap.send_request(
self.__coap_server,
method,
uri_port=int(self.__coap_server_port),
uri_path=uri_path,
payload=message,
token=token,
include_options=include_options
)
return message_id
20 changes: 20 additions & 0 deletions esp32/frozen/Pybytes/_periodical_pin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'''
Copyright (c) 2020, Pycom Limited.
This software is licensed under the GNU GPL version 3 or any
later version, with permitted additional terms. For more information
see the Pycom Licence v1.0 document supplied with this file, or
available at https://www.pycom.io/opensource/licensing
'''


class PeriodicalPin:

TYPE_DIGITAL = 0
TYPE_ANALOG = 1
TYPE_VIRTUAL = 2

def __init__(self, persistent, pin_number, message_type, message, pin_type):
self.pin_number = pin_number
self.message_type = message_type
self.message = message
self.pin_type = pin_type
Loading