move beta to release and bump version

This commit is contained in:
joBr99
2022-11-29 17:55:42 +01:00
parent 3d5970f0a3
commit 5c2b731610

View File

@@ -20,6 +20,8 @@ class Nextion : Driver
var flash_written var flash_written
var flash_buff var flash_buff
var flash_offset var flash_offset
var flash_proto_version
var flash_proto_baud
var awaiting_offset var awaiting_offset
var tcp var tcp
var ser var ser
@@ -136,8 +138,7 @@ class Nextion : Driver
if (self.flash_written==self.flash_size) if (self.flash_written==self.flash_size)
log("FLH: Flashing complete - Time elapsed: %d", (tasmota.millis()-self.flash_start_millis)/1000) log("FLH: Flashing complete - Time elapsed: %d", (tasmota.millis()-self.flash_start_millis)/1000)
self.flash_mode = 0 self.flash_mode = 0
self.ser = nil self.ser.deinit()
tasmota.gc()
self.ser = serial(17, 16, 115200, serial.SERIAL_8N1) self.ser = serial(17, 16, 115200, serial.SERIAL_8N1)
end end
@@ -155,8 +156,15 @@ class Nextion : Driver
log("FLH: Send (High Speed) flash start") log("FLH: Send (High Speed) flash start")
self.flash_start_millis = tasmota.millis() self.flash_start_millis = tasmota.millis()
#self.sendnx(string.format("whmi-wris %d,115200,res0",self.flash_size)) #self.sendnx(string.format("whmi-wris %d,115200,res0",self.flash_size))
self.sendnx(string.format("whmi-wris %d,921600,res0",self.flash_size)) if self.flash_proto_version == 0
self.ser = serial(17, 16, 921600, serial.SERIAL_8N1) self.sendnx(string.format("whmi-wri %d,%d,res0",self.flash_size,self.flash_proto_baud))
else
self.sendnx(string.format("whmi-wris %d,%d,res0",self.flash_size,self.flash_proto_baud))
end
if self.flash_proto_baud != 115200
self.ser.deinit()
self.ser = serial(17, 16, self.flash_proto_baud, serial.SERIAL_8N1)
end
elif size(msg)==1 && msg[0]==0x08 elif size(msg)==1 && msg[0]==0x08
log("FLH: Waiting offset...",3) log("FLH: Waiting offset...",3)
self.awaiting_offset = 1 self.awaiting_offset = 1
@@ -299,6 +307,8 @@ class Nextion : Driver
log("NXP: Initializing Driver") log("NXP: Initializing Driver")
self.ser = serial(17, 16, 115200, serial.SERIAL_8N1) self.ser = serial(17, 16, 115200, serial.SERIAL_8N1)
self.flash_mode = 0 self.flash_mode = 0
self.flash_proto_version = 1
self.flash_proto_baud = 921600
end end
end end
@@ -309,7 +319,7 @@ tasmota.add_driver(nextion)
def get_current_version(cmd, idx, payload, payload_json) def get_current_version(cmd, idx, payload, payload_json)
import string import string
var version_of_this_script = 4 var version_of_this_script = 6
var jm = string.format("{\"nlui_driver_version\":\"%s\"}", version_of_this_script) var jm = string.format("{\"nlui_driver_version\":\"%s\"}", version_of_this_script)
tasmota.publish_result(jm, "RESULT") tasmota.publish_result(jm, "RESULT")
end end
@@ -351,6 +361,39 @@ tasmota.add_cmd('UpdateDriverVersion', update_berry_driver)
def flash_nextion(cmd, idx, payload, payload_json) def flash_nextion(cmd, idx, payload, payload_json)
def task() def task()
nextion.flash_proto_version = 1
nextion.flash_proto_baud = 921600
nextion.flash_nextion(payload)
end
tasmota.set_timer(0,task)
tasmota.resp_cmnd_done()
end
def flash_nextion_adv(cmd, idx, payload, payload_json)
def task()
if idx==0
nextion.flash_proto_version = 1
nextion.flash_proto_baud = 921600
elif idx==1
nextion.flash_proto_version = 0
nextion.flash_proto_baud = 921600
elif idx==2
nextion.flash_proto_version = 1
nextion.flash_proto_baud = 115200
elif idx==3
nextion.flash_proto_version = 0
nextion.flash_proto_baud = 115200
elif idx==4
nextion.flash_proto_version = 1
nextion.flash_proto_baud = 256000
elif idx==5
nextion.flash_proto_version = 0
nextion.flash_proto_baud = 256000
else
nextion.flash_proto_version = 0
nextion.flash_proto_baud = 115200
end
nextion.flash_nextion(payload) nextion.flash_nextion(payload)
end end
tasmota.set_timer(0,task) tasmota.set_timer(0,task)
@@ -370,3 +413,4 @@ end
tasmota.add_cmd('Nextion', send_cmd) tasmota.add_cmd('Nextion', send_cmd)
tasmota.add_cmd('CustomSend', send_cmd2) tasmota.add_cmd('CustomSend', send_cmd2)
tasmota.add_cmd('FlashNextion', flash_nextion) tasmota.add_cmd('FlashNextion', flash_nextion)
tasmota.add_cmd('FlashNextionAdv', flash_nextion_adv)