Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
webserver.addHtml("RSTGPIO"+str(BOARD.RST))
webserver.addTableSeparator("LoRa settings",2,3)
webserver.addFormFloatNumberBox("Frequency","freq",self.freq,433,928)
webserver.addUnit("Mhz")
if self.lora is not None:
try:
afreq = self.lora.get_freq()
except:
afreq = "UNINITIALIZED"
webserver.addFormNote("Current frequency: "+str(afreq)+" Mhz")
webserver.addFormNote("Please check local regulations for your selected frequency!")
options = ["10%","1%","0.1%"]
optionvalues = [10,100,1000]
webserver.addFormSelector("Duty cycle","duty",len(optionvalues),options,optionvalues,None,self.duty)
webserver.addFormNote("Please check your local Duty cycle regulations for your selected frequency!")
webserver.addFormNumericBox("Spreading factor","spreading",self.sf,6,12)
options = ["7.8","10.4","15.6","20.8","31.25","41.7","62.5","125","250","500"]
optionvalues = [BW.BW7_8, BW.BW10_4, BW.BW15_6, BW.BW20_8, BW.BW31_25, BW.BW41_7, BW.BW62_5, BW.BW125, BW.BW250, BW.BW500]
webserver.addFormSelector("Bandwidth","bw",len(optionvalues),options,optionvalues,None,self.bw)
webserver.addUnit("khz")
options = ["CR4/5","CR4/6","CR4/7","CR4/8"]
optionvalues = [CODING_RATE.CR4_5,CODING_RATE.CR4_6,CODING_RATE.CR4_7,CODING_RATE.CR4_8]
webserver.addFormSelector("Coding rate","coding",len(optionvalues),options,optionvalues,None,self.coding)
webserver.addFormNumericBox("Sync Word","sync",self.sync,0,255)
webserver.addHtml("( 0x"+format(self.sync, '02x')+" )")
webserver.addFormNote("Default 0x12, LoRaWAN is 0x34. Nodes can only communicate each other if uses same sync word!")
webserver.addFormCheckBox("Enable Sending","sender",self.enablesend)
choice1 = self.taskdevicepluginconfig[0]
options = rpiSerial.serial_portlist()
if len(options)>0:
webserver.addHtml("Serial Device:")
webserver.addSelector_Head("p201_addr",False)
for o in range(len(options)):
webserver.addSelector_Item(options[o],options[o],(str(options[o])==str(choice1)),False)
webserver.addSelector_Foot()
webserver.addFormNote("For RPI use 'raspi-config' tool: 5- Interfacing Options-P6 Serial- (Kernel logging disabled + serial port hardware enabled) before enable this plugin")
webserver.addFormNumericBox("Baudrate","p201_spd",self.taskdevicepluginconfig[1],50,4000000)
webserver.addFormNote("Generic values: 9600, 19200, 38400, 57600, 115200")
choice2 = self.taskdevicepluginconfig[2]
options = ["5","6","7","8"]
optionvalues = [rpiSerial.FIVEBITS,rpiSerial.SIXBITS,rpiSerial.SEVENBITS,rpiSerial.EIGHTBITS]
webserver.addFormSelector("Bytesize","p201_bsize",len(optionvalues),options,optionvalues,None,int(choice2))
webserver.addFormNote("Most common setting is 8")
choice3 = self.taskdevicepluginconfig[3]
options = ["None","Even","Odd","Mark","Space"]
optionvalues = [rpiSerial.PARITY_NONE,rpiSerial.PARITY_EVEN,rpiSerial.PARITY_ODD,rpiSerial.PARITY_MARK,rpiSerial.PARITY_SPACE]
webserver.addHtml("Parity:")
webserver.addSelector_Head("p201_par",False)
for o in range(len(options)):
webserver.addSelector_Item(options[o],optionvalues[o],(str(optionvalues[o])==str(choice3)),False)
webserver.addSelector_Foot()
webserver.addFormNote("Most common setting is None")
choice4 = self.taskdevicepluginconfig[4]
options = ["1","2"]
optionvalues = [rpiSerial.STOPBITS_ONE,rpiSerial.STOPBITS_TWO]
webserver.addFormSelector("Stopbits","p201_sbit",len(optionvalues),options,optionvalues,None,float(choice4))
webserver.addFormNote("Most common setting is 1")
webserver.addFormNumericBox("Expected max packet size","p201_pkt",self.taskdevicepluginconfig[5],1,4096) # Linux serial buffer is fixed max 4096 bytes
webserver.addUnit("byte")
options = ["7.8","10.4","15.6","20.8","31.25","41.7","62.5","125","250","500"]
optionvalues = [BW.BW7_8, BW.BW10_4, BW.BW15_6, BW.BW20_8, BW.BW31_25, BW.BW41_7, BW.BW62_5, BW.BW125, BW.BW250, BW.BW500]
webserver.addFormSelector("Bandwidth","bw",len(optionvalues),options,optionvalues,None,self.bw)
webserver.addUnit("khz")
options = ["CR4/5","CR4/6","CR4/7","CR4/8"]
optionvalues = [CODING_RATE.CR4_5,CODING_RATE.CR4_6,CODING_RATE.CR4_7,CODING_RATE.CR4_8]
webserver.addFormSelector("Coding rate","coding",len(optionvalues),options,optionvalues,None,self.coding)
webserver.addFormNumericBox("Sync Word","sync",self.sync,0,255)
webserver.addHtml("( 0x"+format(self.sync, '02x')+" )")
webserver.addFormNote("Default 0x12, LoRaWAN is 0x34. Nodes can only communicate each other if uses same sync word!")
webserver.addFormCheckBox("Enable Sending","sender",self.enablesend)
webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
webserver.addFormNote("Default node index for data sending")
except Exception as e:
misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,str(e))
return True
else:
webserver.addHtml("You have modified BOARD constants, so you are an expert!")
webserver.addHtml("DIO0 (IRQ)GPIO"+str(BOARD.DIO0))
webserver.addHtml("DIO1GPIO"+str(BOARD.DIO1))
webserver.addHtml("DIO2GPIO"+str(BOARD.DIO2))
webserver.addHtml("DIO3GPIO"+str(BOARD.DIO3))
webserver.addHtml("RSTGPIO"+str(BOARD.RST))
webserver.addTableSeparator("LoRa settings",2,3)
webserver.addFormFloatNumberBox("Frequency","freq",self.freq,433,928)
webserver.addUnit("Mhz")
if self.lora is not None:
try:
afreq = self.lora.get_freq()
except:
afreq = "UNINITIALIZED"
webserver.addFormNote("Current frequency: "+str(afreq)+" Mhz")
webserver.addFormNote("Please check local regulations for your selected frequency!")
options = ["10%","1%","0.1%"]
optionvalues = [10,100,1000]
webserver.addFormSelector("Duty cycle","duty",len(optionvalues),options,optionvalues,None,self.duty)
webserver.addFormNote("Please check your local Duty cycle regulations for your selected frequency!")
webserver.addFormNumericBox("Spreading factor","spreading",self.sf,6,12)
options = ["7.8","10.4","15.6","20.8","31.25","41.7","62.5","125","250","500"]
optionvalues = [BW.BW7_8, BW.BW10_4, BW.BW15_6, BW.BW20_8, BW.BW31_25, BW.BW41_7, BW.BW62_5, BW.BW125, BW.BW250, BW.BW500]
webserver.addFormSelector("Bandwidth","bw",len(optionvalues),options,optionvalues,None,self.bw)
webserver.addUnit("khz")
options = ["CR4/5","CR4/6","CR4/7","CR4/8"]
optionvalues = [CODING_RATE.CR4_5,CODING_RATE.CR4_6,CODING_RATE.CR4_7,CODING_RATE.CR4_8]
webserver.addFormSelector("Coding rate","coding",len(optionvalues),options,optionvalues,None,self.coding)
def webform_load(self):
webserver.addFormNote("IP and Port parameter is not used!")
webserver.addFormNote("<a href="https://github.com/enesbcs/ESPEasyRetro/blob/master/ESPEasyRetro/_C021.ino">ESP32 reference controller</a>")
webserver.addFormCheckBox("Enable Receiver Service","receiver",self.enablerec)
webserver.addFormNote("Enable this for Gateway/Repeater unit, Disable if you only want to send data!")
try:
if self.bleserv is not None:
webserver.addFormNote("Current Address: "+str(self.bleserv.getaddress()))
except:
pass
webserver.addFormCheckBox("Enable Sending to Default Master Unit","sender",self.enablesend)
webserver.addFormCheckBox("Enable Direct Sending to Units in P2P list","directsender",self.directsend)
webserver.addFormNote("Please respect MASTER-SLAVE nature of BLE and do not create infinite loops!")
webserver.addFormTextBox("Default BLE Master Unit address","masteraddress",self.defaultdestination,23)
webserver.addFormNote("Enable bluetooth then <a href="blescanner">scan RPIEasy BLE address</a> first.")
webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
webserver.addFormNote("Default node index for data sending, only used when Master Unit address is setted")
for x in range(len(Settings.Pinout)):
if Settings.Pinout[x]["altfunc"]==0 and Settings.Pinout[x]["canchange"]>0:
oname = Settings.Pinout[x]["name"][0]
if "PWM" in oname:
if Settings.Pinout[x]["canchange"]==1:
onum=0
try:
onum = int(Settings.Pinout[x]["startupstate"])
if onum<1:
onum=0
except:
pass
oname += " ("+Settings.PinStates[onum]+")"
webserver.addSelector_Item(oname,Settings.Pinout[x]["BCM"],(str(choice)==str(Settings.Pinout[x]["BCM"])),False,"")
webserver.addSelector_Foot()
webserver.addFormNote("Only PWM-able pins can be used! WARNING: internal audio, I2S and other PWM functions might interfere with NeoPixel, so <a href="pinout">disable them at the Hardware page</a>")
webserver.addFormNumericBox("Led Count","p038_leds",self.taskdevicepluginconfig[0],1,2700)
webserver.addFormNumericBox("Initial brightness","p038_bright",self.taskdevicepluginconfig[1],0,255)
return True
def webform_load(self): # create html page for settings
choice1 = self.taskdevicepluginconfig[0]
options = ["0x3f","0x4f","0x5f","0x6f","0x7f"]
optionvalues = [0x3f,0x4f,0x5f,0x6f,0x7f]
webserver.addFormSelector("I2C address","plugin_011_addr",len(optionvalues),options,optionvalues,None,int(choice1))
webserver.addFormNote("Enable <a href="pinout">I2C bus</a> first, than <a href="i2cscanner">search for the used address</a>! 0x7F address is non-standard, so it may not work!")
choice2 = self.taskdevicepluginconfig[1]
options = ["Digital","Analog"]
optionvalues = [0,1]
webserver.addFormSelector("Type","plugin_011_ptype",2,options,optionvalues,None,int(choice2))
webserver.addFormNumericBox("Port number","plugin_011_pnum",self.taskdevicepluginconfig[2],0,101)
webserver.addFormNote("Digital ports 0-13, Analog ports 0-7 (20-27)")
return True
def webform_load(self):
webserver.addFormNote("IP and Port parameter is not used!")
webserver.addFormNote("<a href="https://github.com/enesbcs/ESPEasyRetro/blob/master/ESPEasyRetro/_C021.ino">ESP32 reference controller</a>")
webserver.addFormCheckBox("Enable Receiver Service","receiver",self.enablerec)
webserver.addFormNote("Enable this for Gateway/Repeater unit, Disable if you only want to send data!")
try:
if self.bleserv is not None:
webserver.addFormNote("Current Address: "+str(self.bleserv.getaddress()))
except:
pass
webserver.addFormCheckBox("Enable Sending to Default Master Unit","sender",self.enablesend)
webserver.addFormCheckBox("Enable Direct Sending to Units in P2P list","directsender",self.directsend)
webserver.addFormNote("Please respect MASTER-SLAVE nature of BLE and do not create infinite loops!")
webserver.addFormTextBox("Default BLE Master Unit address","masteraddress",self.defaultdestination,23)
webserver.addFormNote("Enable bluetooth then <a href="blescanner">scan RPIEasy BLE address</a> first.")
webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
webserver.addFormNote("Default node index for data sending, only used when Master Unit address is setted")
return True
def webform_load(self):
webserver.addFormNote("IP and Port parameter is not used!")
try:
choice1 = self.port
options = rpiSerial.serial_portlist()
if len(options)>0:
webserver.addHtml("Serial Device:")
webserver.addSelector_Head("ser_addr",False)
for o in range(len(options)):
webserver.addSelector_Item(options[o],options[o],(str(options[o])==str(choice1)),False)
webserver.addSelector_Foot()
webserver.addFormNote("For RPI use 'raspi-config' tool: 5- Interfacing Options-P6 Serial- (Kernel logging disabled + serial port hardware enabled) before enable this plugin")
webserver.addFormNumericBox("Baudrate","ser_spd",self.baud,50,4000000)
webserver.addFormNote("Generic values: 9600, 19200, 38400, 57600, 115200")
# webserver.addFormCheckBox("Enable Sending","sender",self.enablesend)
webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
webserver.addFormNote("Default node index for data sending")
webserver.addFormNote("Detected gateway MAC address "+str(self.mac))
options = []
optionvalues = []
for i in range(1,14):
options.append(str(i))
optionvalues.append(i)
webserver.addFormSelector("Wifi channel","wchannel",len(options),options,optionvalues,None,self.wchan)
webserver.addFormNote("Set the same wifi channel at all nodes!")
webserver.addWideButton("espnow","ESPNow endpoint management","")
else:
webserver.addFormNote("No serial ports found")
webserver.addFormNote("<a href="https://github.com/enesbcs/ESPEasyRetro/blob/master/ESPEasyRetro/_C021.ino">ESP32 reference controller</a>")
webserver.addFormCheckBox("Enable Receiver Service","receiver",self.enablerec)
webserver.addFormNote("Enable this for Gateway/Repeater unit, Disable if you only want to send data!")
try:
if self.bleserv is not None:
webserver.addFormNote("Current Address: "+str(self.bleserv.getaddress()))
except:
pass
webserver.addFormCheckBox("Enable Sending to Default Master Unit","sender",self.enablesend)
webserver.addFormCheckBox("Enable Direct Sending to Units in P2P list","directsender",self.directsend)
webserver.addFormNote("Please respect MASTER-SLAVE nature of BLE and do not create infinite loops!")
webserver.addFormTextBox("Default BLE Master Unit address","masteraddress",self.defaultdestination,23)
webserver.addFormNote("Enable bluetooth then <a href="blescanner">scan RPIEasy BLE address</a> first.")
webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
webserver.addFormNote("Default node index for data sending, only used when Master Unit address is setted")
return True