main.py 20 KB

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