main.py 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. #!/usr/bin/env python
  2. #version : 2024.08.08
  3. #language : zh
  4. #hardware : pi
  5. import time
  6. from maix import *
  7. import gc
  8. import os,sys
  9. import sys
  10. sys.path.append('/root/')
  11. from CocoPi import BUTTON
  12. from CocoPi import stm8s
  13. from CocoPi import multiFuncGpio
  14. from CocoPi import singleRgb
  15. from CocoPi import LED
  16. gc.enable()
  17. gc.collect()
  18. iic_slaver=stm8s()
  19. iic_slaver.clear()
  20. PIXEL_LED1= multiFuncGpio(0,7)
  21. time.sleep(0.1)
  22. PIXEL_LED2= multiFuncGpio(1,7)
  23. PIXEL_LED1.pixelInit_()
  24. PIXEL_LED2.pixelInit_()
  25. time.sleep(0.1)
  26. L1=singleRgb()
  27. L1.setColor(0,0,0)
  28. L1.show()
  29. time.sleep(0.1)
  30. L2=LED()
  31. L2.out(0)
  32. del iic_slaver
  33. del PIXEL_LED1
  34. del PIXEL_LED2
  35. del L1
  36. del L2
  37. count = 0
  38. def gc_log():
  39. global count
  40. gc.collect()
  41. count = count + 1
  42. splash_theme_color = (15,21,46)
  43. btn_selected = (255,255,255)
  44. btn_unselected = (76,86,127)
  45. txt_selected = (255,255,255)
  46. txt_unselected = (76,86,127)
  47. color_splash_theme = (15,21,46)
  48. color_blue = (31,61,185)
  49. color_blue_lighter = (60,131,211)
  50. color_white = (255,255,255)
  51. color_gray = (60,73,126)
  52. color_orange = (255,165,0)
  53. color_red = (255,0,0)
  54. btn_width = 134
  55. btn_height = 52
  56. btn_y_base = 5
  57. btn_col = (btn_y_base, btn_y_base+btn_width, btn_y_base+152)
  58. btn_row = 180
  59. main_title = (
  60. "运行",
  61. "上次程序",
  62. "打开",
  63. "样例菜单",
  64. "B",
  65. "A"
  66. )
  67. splash_text = (
  68. "系统版本: 2024-08-08 ",
  69. "System version: N/A",
  70. "2. 加载程序后,按下A键两秒退出程序界面.",
  71. " ",
  72. " ",
  73. "启动上次程序中...",
  74. "错误: 未找到程序...",
  75. "错误: 语法有误",
  76. "正在打开样例菜单...",
  77. "未找到样例菜单.",
  78. "运行",
  79. "加载...",
  80. "返回",
  81. "按下C键返回主界面",
  82. "按下D键重启",
  83. "按下B键关机",
  84. "1. 按下A键七秒来关闭或者重启CocoPi系统.",
  85. " ",
  86. " ",
  87. "CocoPi V6",
  88. "/ Linux / AIot /Python /",
  89. "/Graphical programming /",
  90. "------------- 基础 --------------",
  91. "----------- 人工智能 ----------",
  92. "------------ 物联网 ------------",
  93. )
  94. title_logo_text = image.open("/root/preset/img/cocorobo_text.jpg")
  95. iconUpNp = image.open("/root/preset/img/arrow_up_filled.jpg")
  96. iconUpP = image.open("/root/preset/img/arrow_up_pressed.jpg")
  97. iconDownNp = image.open("/root/preset/img/arrow_down_filled.jpg")
  98. iconDownP = image.open("/root/preset/img/arrow_down_pressed.jpg")
  99. frostedGlass = image.open("/root/preset/img/frostedglass_.jpg")
  100. #backUp = image.open("/root/preset/img/backup_48x48.png")
  101. #powerOff = image.open("/root/preset/img/poweroff_48x48.png")
  102. #reBoot = image.open("/root/preset/img/reboot_48x48.png")
  103. run_user_code_path='/root/user_latest_code.py'
  104. run_try_demo_path='/root/play_music.py'
  105. key_A = BUTTON(14)
  106. key_B = BUTTON(8)
  107. key_C = BUTTON(13)
  108. key_D = BUTTON(7)
  109. splash = image.new(size=(320, 240),mode = "RGB")
  110. img_drop=image.new(size=(320,240),mode="RGB")
  111. demo_i=0
  112. demo_j=0
  113. demo_m=0
  114. demo_n=0
  115. pressTime=0
  116. systemRunNum=0
  117. image.load_freetype("/root/preset/fonts/simhei.ttf")
  118. def screenFirstPage():
  119. from maix import display,image,camera
  120. global splash,title_logo_text,btn_col,btn_row,splash_text,txt_unselected,txt_selected,btn_selected,btn_unselected,\
  121. splash_theme_color,btn_height,btn_width,main_title,menuSelect,gc_log,demo_i,demo_j,demo_m,demo_n,screenShow,img_drop,\
  122. frostedGlass
  123. gc_log()
  124. image.load_freetype("/root/preset/fonts/simhei.ttf")
  125. splash.clear()
  126. splash.draw_rectangle(0,0,320,320,color=splash_theme_color,thickness=-1)
  127. splash.draw_image(title_logo_text, btn_col[0]+16, 10)
  128. x, y = image.get_string_size(splash_text[0], 1)
  129. splash.draw_string(btn_col[0]+16, 40, splash_text[19]+" "+splash_text[0], color=(0,255,255), thickness = 1)
  130. # splash.draw_string(btn_col[0], 60, splash_text[20], color=(0,255,255), thickness = 1)
  131. # splash.draw_string(btn_col[0], 80, splash_text[21], color=(0,255,255), thickness = 1)
  132. # splash.draw_string(btn_col[0], 60, splash_text[0], color=(0,255,255), thickness = 1)
  133. splash.draw_string(btn_col[0]+16, btn_row-105, splash_text[16], color=txt_unselected, thickness = 1)
  134. splash.draw_string(btn_col[0]+16, btn_row-85, splash_text[17], color=txt_unselected, thickness = 1)
  135. #splash.draw_string(btn_col[0], btn_row-105, splash_text[18], color=txt_unselected, thickness = 1)
  136. splash.draw_string(btn_col[0]+16, btn_row-65, splash_text[2], color=txt_unselected, thickness = 1)
  137. splash.draw_string(btn_col[0]+16, btn_row-45, splash_text[3], color=txt_unselected, thickness = 1)
  138. splash.draw_string(btn_col[0]+16, btn_row-25, splash_text[4], color=txt_unselected, thickness = 1)
  139. if menuSelect==0:
  140. splash.draw_rectangle(btn_col[1]+40, btn_row, btn_col[1]+btn_width+42, btn_row+btn_height, color=btn_selected, thickness=1)
  141. splash.draw_string(btn_col[1]+52, btn_row+7, main_title[2], color=txt_selected, thickness = 1)
  142. splash.draw_string(btn_col[1]+52, btn_row+27, main_title[3], color=txt_selected, thickness = 1)
  143. splash.draw_string(btn_col[1]+157, btn_row+27, main_title[5], color=txt_unselected, thickness = 1)
  144. splash.draw_rectangle(btn_col[0], btn_row, btn_col[0]+btn_width, btn_row+btn_height, color=btn_selected, thickness=1)
  145. splash.draw_string(btn_col[0]+96, btn_row+7, main_title[0], color=txt_selected, thickness = 1)
  146. splash.draw_string(btn_col[0]+68, btn_row+27, main_title[1], color=txt_selected, thickness = 1)
  147. splash.draw_string(btn_col[0]+7, btn_row+27, main_title[4], color=txt_unselected, thickness = 1)
  148. if menuSelect==1:
  149. splash.draw_rectangle(btn_col[0], btn_row, btn_col[0]+btn_width, btn_row+btn_height, color=btn_unselected, thickness=1)
  150. splash.draw_string(btn_col[0]+7, btn_row+7, main_title[0], color=txt_unselected, thickness = 1)
  151. splash.draw_string(btn_col[0]+7, btn_row+27, main_title[1], color=txt_unselected, thickness = 1)
  152. splash.draw_rectangle(btn_col[1], btn_row, btn_col[1]+btn_width, btn_row+btn_height, color=btn_selected, thickness=1)
  153. splash.draw_string(btn_col[1]+7, btn_row+7, main_title[2], color=txt_selected, thickness = 1)
  154. splash.draw_string(btn_col[1]+7, btn_row+27, main_title[3], color=txt_selected, thickness = 1)
  155. splash.draw_image(frostedGlass, 0, 0,alpha=0.2)
  156. #screenShow()
  157. display.show(splash)
  158. def screenSecondPage():
  159. from maix import display, image,camera
  160. global splash,title_logo_text,btn_col,btn_row,splash_text,txt_unselected,txt_selected,btn_selected,btn_unselected,\
  161. splash_theme_color,btn_height,btn_width,main_title,demoSelect,gc_log,color_splash_theme,color_blue,color_blue_lighter,\
  162. color_white,color_gray,color_orange,color_red,iconUpNp,iconUpP,iconDownNp,iconDownP,demoListText,screenShow,img_drop,\
  163. frostedGlass
  164. gc_log()
  165. image.load_freetype("/root/preset/fonts/simhei.ttf")
  166. splash.clear()
  167. splash.draw_rectangle(0,0,320,240,color=splash_theme_color,thickness=-1)
  168. splash.draw_rectangle(0,0,320,32,color=color_blue,thickness=-1)
  169. splash.draw_image(iconUpNp, 3, 3)
  170. splash.draw_image(iconDownNp, 287, 3)
  171. splash.draw_rectangle(0,214,50,240,color=color_blue,thickness=-1)
  172. splash.draw_rectangle(270,214,320,240,color=color_blue,thickness=-1)
  173. splash.draw_string(12, 218, splash_text[10], color=(255,255,255), thickness = 1)
  174. splash.draw_string(282, 218, splash_text[12], color=(255,255,255), thickness = 1)
  175. demo_i=int(demoSelect/6)
  176. demo_j=demoSelect%6
  177. demo_m=int(demoNum/6)
  178. demo_n=demoNum%6
  179. for j in range(6):
  180. if demo_i==demo_m:
  181. if j>=demo_n:
  182. pass
  183. else:
  184. if j==demo_j:
  185. pass
  186. else:
  187. splash.draw_rectangle(0,33+30*j,319,33+30*(j+1),color=color_gray,thickness=1)
  188. splash.draw_string(8, 39+30*j,demoListText[j+demo_i*6] , color=color_gray, thickness = 1)
  189. else:
  190. if j==demo_j:
  191. pass
  192. else:
  193. splash.draw_rectangle(0,33+30*j,319,33+30*(j+1),color=color_gray,thickness=1)
  194. splash.draw_string(8, 39+30*j,demoListText[j+demo_i*6] , color=color_gray, thickness = 1)
  195. if demoSelect<13:
  196. splash.draw_string(72, 10, splash_text[22], color=(255,255,255), thickness = 1)
  197. elif demoSelect<23:
  198. splash.draw_string(72, 10, splash_text[23], color=(255,255,255), thickness = 1)
  199. else:
  200. splash.draw_string(72, 10, splash_text[24], color=(255,255,255), thickness = 1)
  201. splash.draw_rectangle(0,33+30*demo_j,319,33+30*(demo_j+1),color=color_white,thickness=1)
  202. splash.draw_string(8, 39+30*demo_j,demoListText[demoSelect] , color=color_white, thickness = 1)
  203. splash.draw_string(146, 218, str(demoSelect+1), color=(255,255,255), thickness = 1)
  204. splash.draw_string(160, 218, "/"+str(demoNum), color=(255,255,255), thickness = 1)
  205. splash.draw_image(frostedGlass, 0, 0,alpha=0.2)
  206. #screenShow()
  207. display.show(splash)
  208. def systemPage():
  209. from maix import display, image,camera
  210. import time
  211. global splash,title_logo_text,btn_col,btn_row,splash_text,txt_unselected,txt_selected,btn_selected,btn_unselected,\
  212. splash_theme_color,btn_height,btn_width,main_title,demoSelect,gc_log,color_splash_theme,color_blue,color_blue_lighter,\
  213. color_white,color_gray,color_orange,color_red,iconUpNp,iconUpP,iconDownNp,iconDownP,demoListText,screenShow,img_drop,\
  214. frostedGlass
  215. image.load_freetype("/root/preset/fonts/simhei.ttf")
  216. for i in range(10):
  217. splash.draw_image(frostedGlass, 0, 0,alpha=0.2)
  218. #screenShow()
  219. display.show(splash)
  220. splash.draw_string(80, 68, splash_text[13], 1,color=(0,255,0), thickness = 1)
  221. splash.draw_string(80, 118, splash_text[14], 1,color=(255,255,0), thickness = 1)
  222. splash.draw_string(80, 168, splash_text[15], 1,color=(255,0,0), thickness = 1)
  223. #splash.draw_image(backUp, 20, 140)
  224. #screenShow()
  225. splash.draw_image((image.open("/root/preset/img/backup_00ff00_32x32.png")).rotate(0, adjust=0),40,60,alpha=1)
  226. splash.draw_image((image.open("/root/preset/img/reboot_ffff00_32x32.png")).rotate(0, adjust=0),40,110,alpha=1)
  227. splash.draw_image((image.open("/root/preset/img/poweroff_ff0000_32x32.png")).rotate(0, adjust=0),40,160,alpha=1)
  228. display.show(splash)
  229. pageVal=0
  230. menuSelect=0
  231. demoSelect=0
  232. execVal=0
  233. demoListText=(
  234. "相机",
  235. "相册",
  236. "颜色分析",
  237. "录音机",
  238. "音频播放器",
  239. "播放演示音乐",
  240. "播放演示视频",
  241. "秒表计时器",
  242. "系统时钟显示",
  243. "舵机操控",
  244. "电机操控",
  245. "图片轮播",
  246. "二维码扫描",
  247. "人形识别",
  248. "人脸检测",
  249. "人脸比对",
  250. "物体识别",
  251. "边缘检测",
  252. "手写数字识别",
  253. "车牌识别",
  254. "口罩识别",
  255. "手势识别",
  256. "猜拳识别",
  257. "扫码连接WIFI",
  258. "关于CocoPi",
  259. "无线相机",
  260. "网络天气",
  261. "网络时钟",
  262. "环境监测",
  263. "模型训练:数据集采集",
  264. "模型训练:模型部署",
  265. "手写数字识别本地训练",
  266. "手写数字识别即时训练模型测试",
  267. "可可派-GPT",
  268. "可可派-终端",
  269. "图片分析",
  270. "语音输入生成图片",
  271. "跳跳机器人",
  272. "贪吃蛇",
  273. "声音响度分析",
  274. "声音频谱分析",
  275. "切换语言",
  276. "检查更新",
  277. "撤销更新",
  278. )
  279. demoNameList=(
  280. "01_camera",
  281. "02_photoViewer",
  282. "03_colorDetection",
  283. "04_recorder",
  284. "05_audioPlayer",
  285. "06_musicPlayer",
  286. "07_videoPlayer",
  287. "08_timeCounter",
  288. "09_localTimeClock",
  289. "10_servoControl",
  290. "11_motorControl",
  291. "12_pictureLoopPlay",
  292. "13_qrCodeScanner",
  293. "14_humanDetection",
  294. "15_faceDetection",
  295. "16_faceComparison",
  296. "17_objectRecognition",
  297. "18_edgeDetection",
  298. "19_handWrittenDigiRecognition",
  299. "20_carLicensePlateRecognition",
  300. "21_maskDetection",
  301. "22_gestureRecognition",
  302. "23_fingerGuessing",
  303. "24_connectWiFi",
  304. "25_aboutCocoPi",
  305. "26_internetCamera",
  306. "27_internetWeatherPrediction",
  307. "28_internetTimeClock",
  308. "29_environmentDetection",
  309. "30_training_data_collect",
  310. "31_training_deploy_model",
  311. "32_mnistModelTraining",
  312. "33_mnistCameraTest",
  313. "34_CocoGPT",
  314. "35_CocoTerminal",
  315. "36_pictureAnalysis",
  316. "37_speechToImageSynthesis",
  317. "38_jumpbot",
  318. "39_gluttonousSnake",
  319. "40_soundLoudnessAnalysis",
  320. "41_soundSpectrumAnalysis",
  321. "checkout",
  322. "pull",
  323. "reset",
  324. )
  325. demoNum=len(demoListText)
  326. pageSig=1
  327. selectSig=1
  328. def buttonDectect():
  329. from maix import display, image,camera
  330. import time
  331. import os
  332. global key_A,key_B,key_C,key_D,pageVal,menuSelect,execVal,demoNum,demoSelect,splash,iconUpP,iconDownP,screenShow,img_drop,systemRunNum,pageSig,selectSig
  333. if(pageVal==0):
  334. if(key_A.is_pressed()):
  335. pressTime=time.perf_counter()
  336. while key_A.is_pressed()==1:
  337. if(time.perf_counter()-pressTime)<5:
  338. time.sleep(0.001)
  339. pageVal=1
  340. else:
  341. pageVal=2
  342. break
  343. execVal=0
  344. elif(key_B.is_pressed()):
  345. while key_B.is_pressed()==1:
  346. time.sleep(0.001)
  347. execVal=1
  348. # elif (key_B.is_pressed()):
  349. # while key_B.is_pressed()==1:
  350. # time.sleep(0.001)
  351. # pageVal=1
  352. else:
  353. pass
  354. elif(pageVal==1):
  355. if execVal==0:
  356. if(key_D.is_pressed()):
  357. splash.draw_image(iconUpP, 3, 3)
  358. #screenShow()
  359. display.show(splash)
  360. while key_D.is_pressed()==1:
  361. time.sleep(0.001)
  362. demoSelect=demoSelect-1
  363. if(demoSelect==-1):
  364. demoSelect=demoNum-1
  365. elif (key_C.is_pressed()):
  366. splash.draw_image(iconDownP, 287, 3)
  367. #screenShow()
  368. display.show(splash)
  369. while key_C.is_pressed()==1:
  370. time.sleep(0.001)
  371. demoSelect=demoSelect+1
  372. if(demoSelect==demoNum):
  373. demoSelect=0
  374. elif (key_B.is_pressed()):
  375. while key_B.is_pressed()==1:
  376. time.sleep(0.001)
  377. execVal=2+demoSelect
  378. elif (key_A.is_pressed()):
  379. while key_A.is_pressed()==1:
  380. time.sleep(0.001)
  381. menuSelect=0
  382. pageVal=0
  383. demoSelect=0
  384. execVal=0
  385. try:
  386. with open( '/tmp/page.txt', 'w' ) as f:
  387. f.write(str(pageVal))
  388. except:
  389. pass
  390. try:
  391. with open( '/tmp/menu.txt', 'w' ) as f:
  392. f.write(str(demoSelect))
  393. except:
  394. pass
  395. pageSig=1
  396. selectSig=1
  397. else:
  398. pass
  399. else:
  400. if (key_A.is_pressed()):
  401. while key_A.is_pressed()==1:
  402. time.sleep(0.001)
  403. menuSelect=0
  404. pageVal=0
  405. demoSelect=0
  406. execVal=0
  407. systemRunNum=0
  408. elif pageVal==2:
  409. if(key_C.is_pressed()):
  410. pageVal=0
  411. menuSelect=0
  412. pageVal=0
  413. demoSelect=0
  414. execVal=0
  415. systemRunNum=0
  416. elif key_B.is_pressed():
  417. os.system("poweroff")
  418. elif key_D.is_pressed():
  419. os.system("reboot")
  420. else:
  421. pass
  422. def running():
  423. from maix import display, image,camera
  424. global splash,title_logo_text,btn_col,btn_row,splash_text,txt_unselected,txt_selected,btn_selected,btn_unselected,\
  425. splash_theme_color,btn_height,btn_width,main_title,menuSelect,pageVal,execVal,screenFirstPage,screenSecondPage,\
  426. color_splash_theme,color_blue,color_blue_lighter,color_white,color_gray,color_orange,color_red,demo_i,demo_j,\
  427. demo_m,demo_n,screenShow,img_drop,systemRunNum,systemPage,demoNameList,pageSig,selectSig,demoSelect
  428. if pageSig==1:
  429. try:
  430. with open( '/tmp/page.txt', 'r' ) as f:
  431. pageVal=int(f.read())
  432. print(pageVal)
  433. pageSig=0
  434. except:
  435. pass
  436. if selectSig==1:
  437. try:
  438. with open( '/tmp/menu.txt', 'r' ) as f:
  439. demoSelect=int(f.read())
  440. print(demoSelect)
  441. selectSig=0
  442. except:
  443. pass
  444. if(pageVal==0):
  445. screenFirstPage()
  446. if(execVal==0):
  447. pass
  448. #splash.draw_rectangle(btn_col[0], btn_row-26,btn_col[0]+220,26, color=splash_theme_color, thickness=1)
  449. #screenShow()
  450. #display.show(splash)
  451. else:
  452. try:
  453. splash.draw_string(btn_col[0], btn_row-25, splash_text[5], color=(0,255,255),thickness = 1)
  454. #screenShow()
  455. display.show(splash)
  456. time.sleep(0.5)
  457. os.system("ln -sf %s /tmp/event && touch /tmp/start" % "/root/user_latest_code.py")
  458. except BaseException as e:
  459. execVal=0
  460. print(str(e))
  461. splash.draw_rectangle(btn_col[0], btn_row-26,btn_col[0]+220,26, color=splash_theme_color, thickness=1)
  462. splash.draw_string(btn_col[0], btn_row-85, splash_text[9], color=(255,0,0), thickness = 1)
  463. #screenShow()
  464. display.show(splash)
  465. elif(pageVal==1):
  466. if(execVal==0):
  467. screenSecondPage()
  468. #print("show(demoSelect)")
  469. else:
  470. demo_i=int(demoSelect/6)
  471. demo_j=demoSelect%6
  472. demo_m=int(demoNum/6)
  473. demo_n=demoNum%6
  474. splash.draw_rectangle(0,33+30*demo_j,319,33+30*(demo_j+1),color=color_orange,thickness=-1)
  475. splash.draw_rectangle(0,33+30*demo_j,319,33+30*(demo_j+1),color=color_white,thickness=1)
  476. splash.draw_string(8, 39+30*demo_j,splash_text[11] , color=color_white, thickness = 1)
  477. #screenShow()
  478. display.show(splash)
  479. time.sleep(0.5)
  480. app_path_1='ln -sf /root/preset/app/'
  481. app_path_2='.py /tmp/event && touch /tmp/start'
  482. app_path=app_path_1+demoNameList[execVal-2]+app_path_2
  483. #print(app_path)
  484. try:
  485. with open( '/tmp/page.txt', 'w' ) as f:
  486. f.write(str(pageVal))
  487. except:
  488. pass
  489. try:
  490. with open( '/tmp/menu.txt', 'w' ) as f:
  491. f.write(str(demoSelect))
  492. except:
  493. pass
  494. pageSig=1
  495. selectSig=1
  496. os.system(app_path)
  497. else:
  498. if systemRunNum==0:
  499. systemPage()
  500. systemRunNum=systemRunNum+1
  501. else:
  502. pass
  503. def screenShow():
  504. from maix import image,display,camera
  505. global img_drop
  506. screenCapture=splash.crop(0,0,240,320)
  507. img_drop.draw_image((screenCapture.rotate(0,adjust=1)),0,0)
  508. #img_drop.draw_image((screenCapture.rotate(-90,adjust=1)),0,0)
  509. display.show(img_drop)
  510. try:
  511. with open( '/tmp/filesyStem.txt', 'w' ) as f:
  512. f.write("a")
  513. #os.system("rm /etc/wifi/wpa_supplicant.conf && touch /etc/wifi/wpa_supplicant.conf && sync && fsck.ext4 -p /dev/root && mount -o remount -o rw /dev/root && rm /etc/wifi/wpa_supplicant.conf && touch /etc/wifi/wpa_supplicant.conf && sync &")
  514. os.system("sync && rm /tmp/filesyStem.txt && sync")
  515. #os.system("fsck.ext4 -p /dev/root && mount -o remount -o rw /dev/root")
  516. #os.system("rm /etc/wifi/wpa_supplicant.conf && touch /etc/wifi/wpa_supplicant.conf && sync")
  517. except:
  518. os.system("fsck.ext4 -p /dev/root && mount -o remount -o rw /dev/root")
  519. try:
  520. os.popen("cd /root/preset/server/ && python wirelessServer.py &")
  521. except:
  522. pass
  523. while True:
  524. buttonDectect()
  525. running()
  526. del key_A
  527. del key_B
  528. del key_C
  529. del key_D
  530. �����