state4= False runSW4on=False if runSW4off: a.SW4[2]=0 a.SW4[4]=time.time() if state4 == False: actions.run_action(conf.get('SWITCH4', 'off_action'), conf.get('SWITCH4', 'off_command'), conf,'') state1= True runSW1off=False #end switches #send mail and twitter if conf.get('GMAIL', 'enable')=='1': if conf.get('GMAIL', 'periodicity') and conf.get('GMAIL', 'periodicity')!='0': now= time.time() if not conf.get('GMAIL', 'last_send'): conf.set('GMAIL', 'last_send', str(now)) last_send = float(conf.get('GMAIL', 'last_send')) periodicity = float(conf.get('GMAIL', 'periodicity'))*60 if (now-last_send) > periodicity: conf.set('GMAIL', 'last_send', str(now)) send_gmail(error) if conf.get('TWITTER', 'enable')=='1': if conf.get('TWITTER', 'periodicity') and conf.get('TWITTER', 'periodicity')!='0': now= time.time() if not conf.get('TWITTER', 'last_send'): conf.set('TWITTER', 'last_send', str(now)) last_send = float(conf.get('TWITTER', 'last_send')) periodicity = float(conf.get('TWITTER', 'periodicity'))*60 if (now-last_send) > periodicity: conf.set('TWITTER', 'last_send', str(now)) send_twitter(error)
MCP=[] adjust_point=[] SignalK='' data=conf.get('SPI', 'mcp') try: temp_list=eval(data) except:temp_list=[] analog_=False for ii in temp_list: if '.*.' in ii[2]: ii[2]=ii[2].replace('*', ii[3]) MCP.append(ii) if ii[0]==1:analog_=True if ii[0]==1 and ii[4]==1: if not conf.has_option('SPI', 'value_'+str(ii[1])): temp_list=[[0,0],[1023,1023]] conf.set('SPI', 'value_'+str(ii[1]), str(temp_list)) conf.read() data=conf.get('SPI', 'value_'+str(ii[1])) try: temp_list=eval(data) except:temp_list = [] adjust_point.append(temp_list) else: adjust_point.append([]) if analog_: try: spi = spidev.SpiDev() spi.open(0,1) spi.max_speed_hz = 200000
ssid=boot_conf.get('OPENPLOTTER', 'ssid') passw=boot_conf.get('OPENPLOTTER', 'pass') hw_mode = boot_conf.get('OPENPLOTTER', 'hw_mode') channel = boot_conf.get('OPENPLOTTER', 'channel') wpa = boot_conf.get('OPENPLOTTER', 'wpa') boot_ap=1 except: boot_ap=0 try: share=boot_conf.get('OPENPLOTTER', 'share') boot_sh=1 except: boot_sh=0 conf=Conf() if boot_ap==1: conf.set('WIFI', 'enable', '1') if device: conf.set('WIFI', 'device', device) else: conf.set('WIFI', 'device', 'wlan0') if ssid: conf.set('WIFI', 'ssid', ssid) else: conf.set('WIFI', 'ssid', 'OpenPlotter') if passw: conf.set('WIFI', 'password', passw) else: conf.set('WIFI', 'password', '12345678') if hw_mode: conf.set('WIFI', 'hw_mode', hw_mode) else: conf.set('WIFI', 'hw_mode', 'g') if channel: conf.set('WIFI', 'channel', channel) else: conf.set('WIFI', 'channel', '6') if wpa: conf.set('WIFI', 'wpa', wpa) else: conf.set('WIFI', 'wpa', '2') if boot_sh==1: if share: conf.set('WIFI', 'share', share) else: conf.set('WIFI', 'share', '0')
device='' ssid='' passw='' try: boot_conf = ConfigParser.SafeConfigParser() boot_conf.read('/boot/config.txt') device=boot_conf.get('OPENPLOTTER', 'device') ssid=boot_conf.get('OPENPLOTTER', 'ssid') passw=boot_conf.get('OPENPLOTTER', 'pass') except Exception,e: print str(e) conf=Conf() if device and ssid and passw: conf.set('WIFI', 'enable', '1') conf.set('WIFI', 'device', device) conf.set('WIFI', 'ssid', ssid) conf.set('WIFI', 'password', passw) delay=int(conf.get('STARTUP', 'delay')) kplex=conf.get('STARTUP', 'kplex') opencpn=conf.get('STARTUP', 'opencpn') opencpn_no=conf.get('STARTUP', 'opencpn_no_opengl') opencpn_fullscreen=conf.get('STARTUP', 'opencpn_fullscreen') x11vnc=conf.get('STARTUP', 'x11vnc') gps_time=conf.get('STARTUP', 'gps_time') signalk=conf.get('SIGNALK', 'enable') enable=conf.get('AIS-SDR', 'enable')
class addSKtoN2K(wx.Dialog): def __init__(self): self.conf = Conf() self.home = self.conf.home self.currentpath = self.conf.get('GENERAL', 'op_folder') Language(self.conf) style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, None, title=_('Generate N2K from Signal K'),style=style) self.Bind(wx.EVT_CLOSE, self.when_closed) self.SetInitialSize((720, 400)) #self.SetAutoLayout(1) #self.SetupScrolling() self.icon = wx.Icon(self.currentpath + '/static/icons/openplotter.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) self.panel = wx.Panel(self) self.list_N2Kgen = [ ['126992','System Time',''], ['127245','Rudder','steering.rudderAngle'], ['127250','Heading','navigation.headingMagnetic'], ['127257','Attitude','navigation.attitude.pitch, navigation.attitude.roll, navigation.attitude.yaw'], ['127488','Engine_Rapid','propulsion.port.revolutions'], ['127488_1','Engine_Rapid','propulsion.starboard.revolutions'], ['127489','Engine','propulsion.port.oilTemperature, propulsion.port.temperature'], ['127489_1','Engine','propulsion.starboard.oilTemperature, propulsion.starboard.temperature'], ['127505','FluidLevel','tanks.fuel.standard.capacity, tanks.fuel.standard.currentLevel'], ['127505_1','FluidLevel','tanks.liveWell.standard.capacity, tanks.liveWell.standard.currentLevel'], ['127505_2','FluidLevel','tanks.wasteWater.standard.capacity, tanks.wasteWater.standard.currentLevel'], ['127505_3','FluidLevel','tanks.blackWater.standard.capacity, tanks.blackWater.standard.currentLevel'], ['127508','Battery_Status','electrical.batteries.service.voltage, electrical.batteries.service.current, electrical.batteries.service.temperature'], ['128259','Speed','navigation.speedOverGround, navigation.speedThroughWater'], ['128267','Depth','environment.depth.belowTransducer, environment.depth.surfaceToTransducer'], ['128275','Distance_Log','navigation.log, navigation.logTrip'], ['129025','Position_Rapid','navigation.position.latitude, navigation.position.longitude'], ['129026','COG_SOG','navigation.courseOverGroundTrue, navigation.speedOverGround'], ['130306_2','Wind Data','environment.wind.angleApparent, environment.wind.speedApparent'], ['130306_3','Wind Data','environment.wind.angleTrueWater, environment.wind.speedTrue'], ['130310','Environmental_Parameters','environment.outside.pressure, environment.outside.temperature, environment.water.temperature'], ['130311','Environmental_Parameters','environment.outside.pressure, environment.inside.humidity, environment.water.temperature'], ['130316','Temperature','environment.inside.refrigerator.temperature'], ['130316_1','Temperature','propulsion.port.exhaustTemperature'] ] self.list_N2K = CheckListCtrl(self.panel, 100) self.list_N2K.InsertColumn(0, _('PGN'), width=100) self.list_N2K.InsertColumn(1, _('description'), width=250) self.list_N2K.InsertColumn(2, _('Signal K variable'), width=920) self.list_N2K.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_selected) OK = wx.Button(self.panel, label=_('Apply changes')) OK.Bind(wx.EVT_BUTTON, self.on_OK) hlistbox = wx.BoxSizer(wx.HORIZONTAL) hlistbox.Add(self.list_N2K, 1, wx.ALL | wx.EXPAND, 5) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hlistbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(OK, 0, wx.ALL, 5) self.panel.SetSizer(vbox) for ii in self.list_N2Kgen: self.list_N2K.Append(ii) data = self.conf.get('N2K', 'pgn_generate') try: self.PGN_list = eval(data) except: self.PGN_list = [] i=0 for ii in self.list_N2Kgen: if str(ii[0]) in self.PGN_list: self.list_N2K.CheckItem(i) i += 1 def on_OK(self,e): result = [] i=0 for ii in self.list_N2Kgen: if self.list_N2K.IsChecked(i): result.append(str(ii[0])) i += 1 self.conf.set('N2K', 'pgn_generate', str(result)) N2K_output=self.conf.get('N2K', 'output') if N2K_output == '1': subprocess.call(['pkill', '-f', 'SK-base_d.py']) subprocess.Popen(['python',self.currentpath+'/SK-base_d.py']) self.when_closed(e) def on_selected(self,e): pass def when_closed(self,e): self.Destroy()
try: triggers=eval(data) except:triggers=[] #stop all if action=='0': i=0 for ii in triggers: templist=ii[4] start=0 for iii in templist: if iii[0]==start_all_actions: start=1 triggers[i][0]=start i=i+1 conf.set('ACTIONS', 'triggers', str(triggers)) subprocess.call(['pkill', '-f', 'SK-base_d.py']) subprocess.Popen(['pkill', '-9', 'mpg123']) subprocess.Popen(['python', currentpath + '/SK-base_d.py']) #start all if action=='1': i=0 for ii in triggers: triggers[i][0]=1 i=i+1 conf.set('ACTIONS', 'triggers', str(triggers)) subprocess.call(['pkill', '-f', 'SK-base_d.py']) subprocess.Popen(['python', currentpath + '/SK-base_d.py']) app = wx.App()
class MyFrame(wx.Frame): def __init__(self): self.ttimer = 40 self.conf = Conf() self.home = self.conf.home self.currentpath = self.home + self.conf.get( 'GENERAL', 'op_folder') + '/openplotter' try: self.ser = serial.Serial(self.conf.get('N2K', 'can_usb'), 115200, timeout=0.5) except: print 'failed to start N2K output setting on ' + self.conf.get( 'N2K', 'can_usb') sys.exit(0) Language(self.conf) Buf_ = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) self.Buffer = bytearray(Buf_) self.Zustand = 6 self.buffer = 0 self.PGN_list = [] self.list_N2K_txt = [] self.list_count = [] self.p = 0 wx.Frame.__init__(self, None, title="N2K setting", size=(650, 435)) self.Bind(wx.EVT_CLOSE, self.OnClose) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.timer_act, self.timer) self.SetFont( wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.icon = wx.Icon(self.currentpath + '/openplotter.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) panel = wx.Panel(self, 100) wx.StaticText(panel, wx.ID_ANY, label="TX PGN", style=wx.ALIGN_CENTER, pos=(10, 5)) self.list_N2K = CheckListCtrl(panel, 400, 260) self.list_N2K.SetBackgroundColour((230, 230, 230)) self.list_N2K.SetPosition((10, 25)) self.list_N2K.InsertColumn(0, _('PGN'), width=90) self.list_N2K.InsertColumn(1, _('info'), width=200) wx.StaticText(panel, wx.ID_ANY, label="enabled transmit PGN:", style=wx.ALIGN_CENTER, pos=(10, 300)) self.printing = wx.StaticText(panel, size=(600, 70), pos=(10, 320)) self.check_b = wx.Button(panel, label=_('check'), size=(70, 32), pos=(550, 20)) self.Bind(wx.EVT_BUTTON, self.check, self.check_b) self.apply_b = wx.Button(panel, label=_('apply'), size=(70, 32), pos=(550, 60)) self.Bind(wx.EVT_BUTTON, self.apply, self.apply_b) self.Centre() self.read_N2K() self.timer.Start(self.ttimer) self.check(0) self.Show(True) def check(self, e): self.Send_Command(1, 0x49, 0) time.sleep(0.2) self.read_stick_check() def apply(self, e): st = '' counter = 0 for ii in self.list_N2K_txt: if self.list_N2K.IsChecked(counter): exist = 0 for jj in self.PGN_list: if ii[0] == str(jj): exist = 1 if exist == 0: st += ii[0] + ' ' if len(self.PGN_list) < 36: self.sendTX_PGN(int(ii[0]), 1) self.PGN_list.append(ii[0]) time.sleep(0.2) counter += 1 print 'new PGNs=', st st = '' for jj in self.PGN_list: counter = 0 for ii in self.list_N2K_txt: exist = 0 if ii[0] == str(jj): if not self.list_N2K.IsChecked(counter): exist = 1 if exist == 1: st += ii[0] + ' ' self.sendTX_PGN(int(ii[0]), 0) time.sleep(0.2) counter += 1 print 'del PGNs=', st self.Send_Command(1, 0x01, 0) def sendTX_PGN(self, lPGN, add): if add: data_ = (0, 0, 0, 0, 1, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF) else: data_ = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data = bytearray(data_) data[0] = lPGN & 255 data[1] = (lPGN >> 8) & 255 data[2] = (lPGN >> 16) & 255 self.Send_Command(14, 0x47, data) def Send_Command(self, length, command, arg): data_ = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data = bytearray(data_) data[0] = 0xa1 #command data[1] = length #Actisense length data[2] = command i = 3 while i < length + 2: data[i] = arg[i - 3] i += 1 self.SendCommandtoSerial(data) def timer_act(self, e): self.getCharfromSerial() def OnClose(self, event): self.timer.Stop() self.Destroy() def SendCommandtoSerial(self, TXs): crc = 0 #start = codecs.decode('1002', 'hex_codec') start = (0x10, 0x02) ende = codecs.decode('1003', 'hex_codec') ende = (0x10, 0x03) i = 0 while i < TXs[1] + 2: crc += TXs[i] i += 1 crc = (256 - crc) & 255 TXs[TXs[1] + 2] = crc i = 0 self.ser.write(chr(start[0])) self.ser.write(chr(start[1])) while i < TXs[1] + 3: self.ser.write(chr(TXs[i])) #print format(TXs[i], '02x') if TXs[i] == 0x10: self.ser.write(chr(TXs[i])) i += 1 self.ser.write(chr(ende[0])) self.ser.write(chr(ende[1])) def getCharfromSerial(self): bytesToRead = self.ser.inWaiting() if bytesToRead > 0: buffer = self.ser.read(bytesToRead) for i in buffer: #sys.stdout.write(' '+hex(ord(i))) self.parse(ord(i)) def parse(self, b): if self.Zustand == 6: # zu Beginn auf 0x10 warten if b == 0x10: self.Zustand = 0x10 elif self.Zustand == 0x10: if b == 0x10: # 0x10 Schreiben wenn zweimal hintereinander self.Buffer[self.p] = b self.p += 1 self.Zustand = 0 elif b == 0x02: # Anfang gefunden self.p = 0 self.Zustand = 0 elif b == 0x03: # Ende gefunden if self.crcCheck(): #print "CRC" self.output() self.p = 0 self.Zustand = 6 # Auf Anfang zuruecksetzen elif self.Zustand == 0: if b == 0x10: self.Zustand = 0x10 else: self.Buffer[self.p] = b self.p += 1 def crcCheck(self): crc = 0 i = 0 while i < self.p: crc = (crc + self.Buffer[i]) & 255 i += 1 return (crc == 0) def output(self): k = 0 if self.Buffer[0] == 0x93 and self.Buffer[1] == self.p - 3: #i=0 #while i < 10: # sys.stdout.write(' '+hex(self.Buffer[i])) # i += 1 #print ' ' pass else: if self.Buffer[2] == 0x49 and self.Buffer[3] == 0x01: j = 0 st = '' self.PGN_list = [] while j < self.Buffer[14]: i = j * 4 lPGN = self.Buffer[15 + i] + self.Buffer[ 16 + i] * 256 + self.Buffer[17 + i] * 256 * 256 self.PGN_list.append(lPGN) j += 1 st += str(lPGN) + ' ' if ((j) % 6) == 0 and j > 0: st += '\n' self.printing.SetLabel(st) self.conf.set('N2K', 'pgn_output', st) def getCommandfromSerial(self, RXs): crc = 0 start = (0x10, 0x02) ende = (0x10, 0x03) i = 0 while i < RXs[1] + 2: crc += RXs[i] i += 1 crc = (256 - crc) & 255 RXs[RXs[1] + 2] = crc i = 0 self.ser.write(chr(start[0])) self.ser.write(chr(start[1])) while i < RXs[1] + 3: self.ser.write(chr(RXs[i])) #print format(RXs[i], '02x') if RXs[i] == 0x10: self.ser.write(chr(RXs[i])) i += 1 self.ser.write(chr(ende[0])) self.ser.write(chr(ende[1])) def read_N2K(self): if self.list_N2K.GetItemCount() < 3: while self.list_N2K.GetItemCount() > 3: self.list_N2K.DeleteItem(self.list_N2K.GetItemCount() - 1) self.list_N2K_txt = [] with open(self.currentpath + '/classes/N2K_PGN.csv') as f: self.list_N2K_txt = [ x.strip('\n\r').split(',') for x in f.readlines() ] for ii in self.list_N2K_txt: pgn = int(ii[0]) self.list_N2K.Append([pgn, ii[1]]) def read_stick_check(self): counter = 0 for ii in self.list_N2K_txt: for jj in self.PGN_list: if ii[0] == str(jj): self.list_N2K.CheckItem(counter) counter += 1
ssid = '' passw = '' try: boot_conf = ConfigParser.SafeConfigParser() boot_conf.read('/boot/config.txt') device = boot_conf.get('OPENPLOTTER', 'device') ssid = boot_conf.get('OPENPLOTTER', 'ssid') passw = boot_conf.get('OPENPLOTTER', 'pass') except Exception, e: print str(e) conf = Conf() if device and ssid and passw: conf.set('WIFI', 'enable', '1') conf.set('WIFI', 'device', device) conf.set('WIFI', 'ssid', ssid) conf.set('WIFI', 'password', passw) delay = int(conf.get('STARTUP', 'delay')) kplex = conf.get('STARTUP', 'kplex') opencpn = conf.get('STARTUP', 'opencpn') opencpn_no = conf.get('STARTUP', 'opencpn_no_opengl') opencpn_fullscreen = conf.get('STARTUP', 'opencpn_fullscreen') x11vnc = conf.get('STARTUP', 'x11vnc') gps_time = conf.get('STARTUP', 'gps_time') signalk = conf.get('SIGNALK', 'enable') enable = conf.get('AIS-SDR', 'enable')
trigger_actions.pop() for index,item in enumerate(trigger_actions): ii=item.split(',') trigger_actions[index]=ii tmp='' #stop all if action=='0': for index,item in enumerate(triggers): start_all=False for i in trigger_actions: if int(i[0])==index and i[1]==start_all_actions: start_all=True if start_all==False: tmp +='0,' if start_all==True: tmp +='1,' tmp +=triggers[index][1]+','+triggers[index][2]+','+triggers[index][3]+'||' conf.set('ACTIONS', 'triggers', tmp) subprocess.Popen(['pkill', '-f', 'message.py']) subprocess.Popen(['pkill', '-9', 'mpg123']) #start all if action=='1': for index,item in enumerate(triggers): tmp +='1,' tmp +=triggers[index][1]+','+triggers[index][2]+','+triggers[index][3]+'||' conf.set('ACTIONS', 'triggers', tmp) subprocess.call(['pkill', '-f', 'monitoring.py']) subprocess.Popen(['python',currentpath+'/monitoring.py']) app = wx.App()
try: triggers=eval(data) except:triggers=[] #stop all if action=='0': i=0 for ii in triggers: templist=ii[4] start_all=False for iii in templist: if iii[0]==start_all_actions: start_all=True if start_all==True: triggers[i][0]=1 else: triggers[i][0]=0 i=i+1 conf.set('ACTIONS', 'triggers', str(triggers)) subprocess.Popen(['pkill', '-f', 'message.py']) subprocess.Popen(['pkill', '-9', 'mpg123']) #start all if action=='1': i=0 for ii in triggers: triggers[i][0]=1 i=i+1 conf.set('ACTIONS', 'triggers', str(triggers)) subprocess.call(['pkill', '-f', 'monitoring.py']) subprocess.Popen(['python',currentpath+'/monitoring.py']) app = wx.App()
hw_mode = boot_conf.get('OPENPLOTTER', 'hw_mode') channel = boot_conf.get('OPENPLOTTER', 'channel') wpa = boot_conf.get('OPENPLOTTER', 'wpa') boot_ap = 1 except: boot_ap = 0 try: share = boot_conf.get('OPENPLOTTER', 'share') boot_sh = 1 except: boot_sh = 0 conf = Conf() if boot_ap == 1: conf.set('WIFI', 'enable', '1') if device: conf.set('WIFI', 'device', device) else: conf.set('WIFI', 'device', 'wlan0') if ssid: conf.set('WIFI', 'ssid', ssid) else: conf.set('WIFI', 'ssid', 'OpenPlotter') if passw: conf.set('WIFI', 'password', passw) else: conf.set('WIFI', 'password', '12345678') if hw_mode: conf.set('WIFI', 'hw_mode', hw_mode) else: conf.set('WIFI', 'hw_mode', 'g') if channel: conf.set('WIFI', 'channel', channel) else: conf.set('WIFI', 'channel', '6') if wpa: conf.set('WIFI', 'wpa', wpa) else: conf.set('WIFI', 'wpa', '2') if boot_sh == 1: if share: conf.set('WIFI', 'share', share) else: conf.set('WIFI', 'share', '0')