mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 19:26:37 +00:00
Zigbee firmware for Sonoff-ZB-Pro v20230507 (#18968)
This commit is contained in:
parent
e0619c8602
commit
339c1cedb7
@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Berry added f-strings as an alternative to string formatting
|
- Berry added f-strings as an alternative to string formatting
|
||||||
- Matter display the remote Device Name instead of IP address
|
- Matter display the remote Device Name instead of IP address
|
||||||
- Berry Walrus operator ':='
|
- Berry Walrus operator ':='
|
||||||
|
- Zigbee firmware for Sonoff-ZB-Pro v20230507
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ class intelhex
|
|||||||
|
|
||||||
# internally used, verify each line
|
# internally used, verify each line
|
||||||
def munch_line(parse_cb)
|
def munch_line(parse_cb)
|
||||||
|
import string
|
||||||
import crc
|
import crc
|
||||||
var crc_sum = crc.sum
|
var crc_sum = crc.sum
|
||||||
var tas = tasmota
|
var tas = tasmota
|
||||||
@ -84,25 +85,35 @@ class intelhex
|
|||||||
var b_fromhex = b.fromhex
|
var b_fromhex = b.fromhex
|
||||||
var self_f = self.f
|
var self_f = self.f
|
||||||
var readline = self_f.readline
|
var readline = self_f.readline
|
||||||
|
var defer = 10
|
||||||
while true
|
while true
|
||||||
yield(tas) # tasmota.yield() -- faster version
|
defer = defer - 1
|
||||||
|
if defer <= 0
|
||||||
|
yield(tas) # tasmota.yield() -- faster version
|
||||||
|
defer = 10
|
||||||
|
end
|
||||||
var line = readline(self_f) # self.f.readline()
|
var line = readline(self_f) # self.f.readline()
|
||||||
|
if line[-1] == '\n' line = line[0..-2] end
|
||||||
|
if line[-1] == '\r' line = line[0..-2] end
|
||||||
|
|
||||||
|
# line = string.tr(line, '\r', '')
|
||||||
|
# line = string.tr(line, '\n', '')
|
||||||
# print(line)
|
# print(line)
|
||||||
if line == "" raise "value_error", "unexpected end of file" end
|
if line == "" raise "value_error", "unexpected end of file" end
|
||||||
if line[0] != ":" continue end # ignore empty line or not starting with ':'
|
if line[0] != ":" continue end # ignore empty line or not starting with ':'
|
||||||
|
|
||||||
b = b_fromhex(b, line, 1) # b.fromhex(line, 1) # convert to bytes, avoid allocating a new object
|
b = b_fromhex(b, line, 1) # b.fromhex(line, 1) # convert to bytes, avoid allocating a new object
|
||||||
var sz = b[0]
|
var sz = b[0]
|
||||||
|
|
||||||
# check size
|
# check size
|
||||||
if size(b) != sz+5 raise "value_error", "invalid size for line: "+line end
|
if size(b) != sz+5 raise "value_error", f"invalid size for line: {line} {size(b)=} {sz=}" end
|
||||||
|
|
||||||
var record_type = b[3]
|
var record_type = b[3]
|
||||||
# 00: low address + data
|
# 00: low address + data
|
||||||
# 01: end of file
|
# 01: end of file
|
||||||
|
# 02: Extended Segment Address
|
||||||
# 04: high address
|
# 04: high address
|
||||||
if record_type != 0 && record_type != 1 && record_type != 4
|
if record_type != 0 && record_type != 1 && record_type != 2 && record_type != 4
|
||||||
raise "value_error", "unsupported record_type: "+str(record_type)
|
raise "value_error", f"unsupported record_type: {record_type} {line=}"
|
||||||
end
|
end
|
||||||
|
|
||||||
offset_low = b_get(b, 1, -2) # b.get(1,-2)
|
offset_low = b_get(b, 1, -2) # b.get(1,-2)
|
||||||
@ -112,16 +123,19 @@ class intelhex
|
|||||||
if record_type == 1 break end # end of file
|
if record_type == 1 break end # end of file
|
||||||
if record_type == 0
|
if record_type == 0
|
||||||
# data
|
# data
|
||||||
var address = offset_high << 16 | offset_low # full address
|
var address = offset_high + offset_low # full address
|
||||||
#var data = b[4..-2] # actual payload
|
#var data = b[4..-2] # actual payload
|
||||||
parse_cb(address, sz, b, 4)
|
parse_cb(address, sz, b, 4)
|
||||||
|
|
||||||
# OK
|
# OK
|
||||||
# do whatever needed
|
# do whatever needed
|
||||||
# print(format("addr=0x%06X len=0x%02X", address, sz))
|
# print(format("addr=0x%06X len=0x%02X", address, sz))
|
||||||
|
elif record_type == 2
|
||||||
|
if offset_low != 0 raise "value_error", "offset_low not null for cmd 02" end
|
||||||
|
offset_high = b_get(b, 4, -2) << 4
|
||||||
elif record_type == 4
|
elif record_type == 4
|
||||||
if offset_low != 0 raise "value_error", "offset_low not null for cmd 04" end
|
if offset_low != 0 raise "value_error", "offset_low not null for cmd 04" end
|
||||||
offset_high = b_get(b, 4, -2) # b.get(4,-2)
|
offset_high = b_get(b, 4, -2) << 16
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -92,7 +92,7 @@ class sonoff_zb_pro_flasher
|
|||||||
# low-level
|
# low-level
|
||||||
#################################################################################
|
#################################################################################
|
||||||
def _flash_pre()
|
def _flash_pre()
|
||||||
print("FLH: Flashing started (takes 5 minutes during which Tasmota is unresponsive)")
|
print("FLH: Flashing started (takes 5-8 minutes during which Tasmota is unresponsive)")
|
||||||
self.flasher.start()
|
self.flasher.start()
|
||||||
self.flasher.ping()
|
self.flasher.ping()
|
||||||
# erase flash
|
# erase flash
|
||||||
@ -156,11 +156,17 @@ return sonoff_zb_pro_flasher()
|
|||||||
#-
|
#-
|
||||||
# Flash local firmware
|
# Flash local firmware
|
||||||
|
|
||||||
|
import sonoff_zb_pro_flasher as cc
|
||||||
|
cc.load("SonoffZBPro_coord_20230507.hex")
|
||||||
|
cc.check()
|
||||||
|
cc.flash()
|
||||||
|
|
||||||
import sonoff_zb_pro_flasher as cc
|
import sonoff_zb_pro_flasher as cc
|
||||||
cc.load("SonoffZBPro_coord_20220219.hex")
|
cc.load("SonoffZBPro_coord_20220219.hex")
|
||||||
cc.check()
|
cc.check()
|
||||||
cc.flash()
|
cc.flash()
|
||||||
|
|
||||||
|
|
||||||
-#
|
-#
|
||||||
|
|
||||||
#-
|
#-
|
||||||
|
@ -92,7 +92,7 @@ class tubezb_cc2652_flasher
|
|||||||
# low-level
|
# low-level
|
||||||
#################################################################################
|
#################################################################################
|
||||||
def _flash_pre()
|
def _flash_pre()
|
||||||
print("FLH: Flashing started (takes 5 minutes during which Tasmota is unresponsive)")
|
print("FLH: Flashing started (takes 5-8 minutes during which Tasmota is unresponsive)")
|
||||||
self.flasher.start()
|
self.flasher.start()
|
||||||
self.flasher.ping()
|
self.flasher.ping()
|
||||||
# erase flash
|
# erase flash
|
||||||
|
11293
tools/fw_SonoffZigbeeBridgePro_cc2652/SonoffZBPro_coord_20230507.hex
Normal file
11293
tools/fw_SonoffZigbeeBridgePro_cc2652/SonoffZBPro_coord_20230507.hex
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user