Primary.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. #include <stdio.h> /*標準輸入輸出定義*/
  2. #include <stdlib.h> /*標準函數庫定義*/
  3. #include <string.h>
  4. #include <stdint.h>
  5. #include "../Config.h"
  6. #include "../Log/log.h"
  7. #include "../Define/define.h"
  8. #include "../ShareMemory/shmMem.h"
  9. #include "../SelectGun/SelectGun.h"
  10. #include "main.h"
  11. #include "../timeout.h"
  12. struct SysInfoData *pSysInfo = NULL;
  13. struct ChargingInfoData *pDcChargingInfo = NULL;
  14. struct SysConfigData *pSysConfig = NULL;
  15. //------------------------------------------------------------------------------
  16. typedef struct StLedConfig {
  17. //OutputDrvValue[0]
  18. uint8_t LeftButtonLed: 1; //bit 0, H: ON, L:OFF
  19. uint8_t RightButtonLed: 1; //bit 1, H: ON, L:OFF
  20. uint8_t GreenLED: 1; //bit 2, H: ON, L:OFF
  21. uint8_t YellowLED: 1; //bit 3, H: ON, L:OFF
  22. uint8_t RedLED: 1; //bit 4, H: ON, L:OFF
  23. uint8_t SystemLed4: 1; //bit 5, H: ON, L:OFF
  24. uint8_t AcContactor: 1; //bit 6, H: ON, L:OFF
  25. uint8_t Reserved: 1; //bit 7 reserved
  26. } LedConfig;
  27. //------------------------------------------------------------------------------
  28. void ChangeLCM(uint8_t page)
  29. {
  30. pSysInfo->SystemPage = page;
  31. }
  32. // ***********************************
  33. // Enter LCM Page
  34. // ***********************************
  35. void EnterViewPage()
  36. {
  37. ChangeLCM(_LCM_VIEW);
  38. StopSystemTimeoutDet();
  39. }
  40. void EnterAuthorizePage(uint8_t gunIndex)
  41. {
  42. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
  43. log_info("Select Gun(%d) in Authorizing",gunIndex);
  44. ClearDetectPluginFlag(gunIndex);
  45. ChangeGunSelectByIndex(gunIndex);
  46. confirmSelGun(gunIndex);
  47. ChangeLCM(_LCM_START_SCAN);
  48. strcpy((char *)pSysConfig->UserId, "");
  49. setChargerMode(gunIndex,MODE_AUTHORIZING);
  50. StartSystemTimeoutDet(Timeout_ReturnViewPage);
  51. }
  52. void EnterLinkErrorPage()
  53. {
  54. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  55. //ClearDetectPluginFlag();
  56. StopSystemTimeoutDet();
  57. //StopGunInfoTimeoutDet(pSysInfo->CurGunSelected);
  58. ChangeLCM(_LCM_LINK_ERROR);
  59. StartSystemTimeoutDet(Timeout_ReturnViewPage);
  60. //StartGunInfoTimeoutDet(pSysInfo->CurGunSelected,Timeout_LinkError);
  61. }
  62. /*
  63. void EnterDetailViewPage(uint8_t gunIndex)
  64. {
  65. log_info("Show Gun(%d) Detail View",gunIndex);
  66. ChangeGunSelectByIndex(gunIndex);
  67. ChangeLCM(_LCM_DETAIL_VIEW);
  68. StopGunInfoTimeoutDet(gunIndex);
  69. StartGunInfoTimeoutDet(gunIndex,Timeout_DetailView);
  70. }
  71. void EnterAuthorizeStopPage()
  72. {
  73. log_info("Select Gun(%d) in Stopping",pSysInfo->CurGunSelected);
  74. StopGunInfoTimeoutDet(pSysInfo->CurGunSelected);
  75. StopSystemTimeoutDet();
  76. strcpy((char *)pSysConfig->UserId, "");
  77. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  78. if (pDcChargingInfo->isRemoteStart) {
  79. pSysInfo->SystemPage = _LCM_STOP_APP;
  80. } else {
  81. pSysInfo->SystemPage = _LCM_STOP_RFID;
  82. }
  83. StartSystemTimeoutDet(Timeout_ReturnViewPage);
  84. }
  85. */
  86. void StopChargingBtn(uint8_t gunIndex)
  87. {
  88. pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
  89. pDcChargingInfo->SystemStatus = S_TERMINATING;
  90. log_info("Press Button to Stop Charging");
  91. }
  92. void EnterSummaryPage()
  93. {
  94. StopSystemTimeoutDet();
  95. log_info("Showing Summary Page");
  96. pSysInfo->SystemPage = _LCM_SUMMARY;
  97. }
  98. // *****************************
  99. // Enter System status
  100. // *****************************
  101. void ReturnIDLE(uint8_t gunIndex)
  102. {
  103. log_info("Gun(%d) return to IDLE",gunIndex);
  104. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
  105. StopSystemTimeoutDet();
  106. StopGunInfoTimeoutDet(gunIndex);
  107. setChargerMode(gunIndex,MODE_IDLE);
  108. EnterViewPage();
  109. //destroySelGun(gunIndex);
  110. }
  111. void ReturnAuthorize()
  112. {
  113. StopSystemTimeoutDet();
  114. EnterAuthorizePage(pSysInfo->CurGunSelected);
  115. }
  116. void showConfirmStopPage(uint8_t gunIndex)
  117. {
  118. StopSystemTimeoutDet();
  119. ChangeGunSelectByIndex(gunIndex);
  120. log_info("Enter Confirm stop Page");
  121. pSysInfo->SystemPage = _LCM_CONFIRM_STOP;
  122. StartSystemTimeoutDet(Timeout_ReturnViewPage);
  123. }
  124. void CheckLeftButton()
  125. {
  126. DcCommonInfo* ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
  127. pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(LEFT_GUN_NUM);
  128. switch (pSysInfo->SystemPage) {
  129. case _LCM_VIEW:
  130. pSysInfo->CurGunSelected = LEFT_GUN_NUM;
  131. if(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION) {
  132. EnterAuthorizePage(LEFT_GUN_NUM);
  133. pSysInfo->SystemPage = _LCM_START_SCAN;
  134. } else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
  135. showConfirmStopPage(LEFT_GUN_NUM);
  136. } else if (pDcChargingInfo->SystemStatus == S_ALARM ||
  137. pDcChargingInfo->SystemStatus == S_COMPLETE) {
  138. // 有進入充電時
  139. if (ShmDcCommonData->isIntoCharge[LEFT_GUN_NUM]) {
  140. pSysInfo->SystemPage = _LCM_SUMMARY;
  141. } else {
  142. // 未進入充電時顯示連線錯誤
  143. StopSystemTimeoutDet();
  144. StartSystemTimeoutDet(Timeout_LinkError);
  145. pSysInfo->SystemPage = _LCM_LINK_ERROR;
  146. }
  147. }
  148. break;
  149. case _LCM_START_SCAN:
  150. case _LCM_START_AUTHORIZE_FAIL:
  151. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  152. ReturnIDLE(LEFT_GUN_NUM);
  153. }
  154. break;
  155. case _LCM_LINK_ERROR:
  156. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  157. if (pDcChargingInfo->ConnectorPlugIn) {
  158. pSysInfo->SystemPage = _LCM_VIEW;
  159. } else
  160. ReturnIDLE(LEFT_GUN_NUM);
  161. }
  162. break;
  163. case _LCM_SUMMARY:
  164. if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM)
  165. break;
  166. if (pDcChargingInfo->ConnectorPlugIn) {
  167. pSysInfo->SystemPage = _LCM_VIEW;
  168. } else {
  169. log_info("Return View Page");
  170. ReturnIDLE(LEFT_GUN_NUM);
  171. }
  172. break;
  173. case _LCM_ERROR:
  174. if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM)
  175. break;
  176. if (pDcChargingInfo->ConnectorPlugIn)
  177. pSysInfo->SystemPage = _LCM_VIEW;
  178. else
  179. pSysInfo->SystemPage = _LCM_SUMMARY;
  180. break;
  181. case _LCM_CONFIRM_STOP:
  182. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  183. StopChargingBtn(LEFT_GUN_NUM);
  184. } else {
  185. EnterViewPage();
  186. }
  187. break;
  188. case _LCM_WAIT_PLUGIN:
  189. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  190. ReturnIDLE(LEFT_GUN_NUM);
  191. break;
  192. case _LCM_WAIT_PLUGOUT:
  193. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  194. if (pDcChargingInfo->ConnectorPlugIn && pDcChargingInfo->SystemStatus == S_ALARM) {
  195. pSysInfo->SystemPage = _LCM_VIEW;
  196. }
  197. }
  198. break;
  199. }
  200. }
  201. void CheckRightButton()
  202. {
  203. DcCommonInfo* ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
  204. pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(RIGHT_GUN_NUM);
  205. switch (pSysInfo->SystemPage) {
  206. case _LCM_VIEW:
  207. pSysInfo->CurGunSelected = RIGHT_GUN_NUM;
  208. if(pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION) {
  209. EnterAuthorizePage(RIGHT_GUN_NUM);
  210. pSysInfo->SystemPage = _LCM_START_SCAN;
  211. } else if (pDcChargingInfo->SystemStatus == S_CHARGING) {
  212. //EnterDetailViewPage(RIGHT_GUN_NUM);
  213. showConfirmStopPage(RIGHT_GUN_NUM);
  214. } else if (pDcChargingInfo->SystemStatus == S_ALARM ||
  215. pDcChargingInfo->SystemStatus == S_COMPLETE) {
  216. // 有進入充電時
  217. if (ShmDcCommonData->isIntoCharge[RIGHT_GUN_NUM]) {
  218. pSysInfo->SystemPage = _LCM_SUMMARY;
  219. } else {
  220. // 未進入充電時顯示連線錯誤
  221. StopSystemTimeoutDet();
  222. StartSystemTimeoutDet(Timeout_LinkError);
  223. pSysInfo->SystemPage = _LCM_LINK_ERROR;
  224. }
  225. }
  226. break;
  227. case _LCM_START_SCAN:
  228. if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM)
  229. ReturnIDLE(pSysInfo->CurGunSelected);
  230. break;
  231. case _LCM_START_AUTHORIZE_FAIL:
  232. if (pSysInfo->SystemPage == _LCM_START_AUTHORIZE_FAIL && pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  233. break;
  234. ReturnAuthorize();
  235. break;
  236. case _LCM_WAIT_PLUGIN:
  237. if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
  238. ReturnIDLE(RIGHT_GUN_NUM);
  239. }
  240. break;
  241. case _LCM_LINK_ERROR:
  242. if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
  243. if (pDcChargingInfo->ConnectorPlugIn) {
  244. pSysInfo->SystemPage = _LCM_VIEW;
  245. } else
  246. ReturnIDLE(RIGHT_GUN_NUM);
  247. }
  248. break;
  249. /*
  250. case _LCM_DETAIL_VIEW:
  251. EnterAuthorizeStopPage();
  252. break;
  253. case _LCM_STOP_RFID_FAIL:
  254. EnterAuthorizeStopPage();
  255. break;
  256. */
  257. case _LCM_WAIT_PLUGOUT:
  258. if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
  259. if (pDcChargingInfo->ConnectorPlugIn && pDcChargingInfo->SystemStatus == S_ALARM) {
  260. pSysInfo->SystemPage = _LCM_VIEW;
  261. }
  262. }
  263. break;
  264. case _LCM_ERROR:
  265. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  266. break;
  267. if (pDcChargingInfo->ConnectorPlugIn)
  268. pSysInfo->SystemPage = _LCM_VIEW;
  269. else
  270. pSysInfo->SystemPage = _LCM_SUMMARY;
  271. break;
  272. case _LCM_CONFIRM_STOP:
  273. if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
  274. StopChargingBtn(RIGHT_GUN_NUM);
  275. } else {
  276. EnterViewPage();
  277. }
  278. break;
  279. case _LCM_SUMMARY:
  280. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  281. break;
  282. if (pDcChargingInfo->ConnectorPlugIn) {
  283. pSysInfo->SystemPage = _LCM_VIEW;
  284. } else {
  285. log_info("Return View Page");
  286. ReturnIDLE(RIGHT_GUN_NUM);
  287. }
  288. break;
  289. }
  290. }
  291. void CheckPrimaryWarm(void)
  292. {
  293. uint8_t i = 0;
  294. uint8_t Rtn = 0;
  295. struct WARNING_CODE_INFO *pSysWarning = (struct WARNING_CODE_INFO *)GetShmSysWarningInfo();
  296. struct PrimaryMcuData *ShmPrimaryMcuData = (struct PrimaryMcuData *)GetShmPrimaryMcuData();
  297. struct AlarmCodeData *pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
  298. DcCommonInfo *ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
  299. if (pSysWarning->WarningCount > 0) {
  300. Rtn = 0;
  301. for (i = 0; i < pSysWarning->WarningCount; i++) {
  302. if (memcmp(&pSysWarning->WarningCode[i][0], "042251", 6) == 0) {
  303. EmcOccureByString("042251");
  304. ShmDcCommonData->PowerAlarmState.StatusBit.EmergencyStop = YES;
  305. Rtn = 1;
  306. } else if (memcmp(&pSysWarning->WarningCode[i][0], "042252", 6) == 0) {
  307. ShmDcCommonData->PowerAlarmState.StatusBit.DoorOpen = YES;
  308. EmcOccureByString("042252");
  309. Rtn = 1;
  310. } else if (memcmp(&pSysWarning->WarningCode[i][0], "042327", 6) == 0) {
  311. ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP = YES;
  312. EmcOccureByString("042327");
  313. Rtn = 1;
  314. } else if (memcmp(&pSysWarning->WarningCode[i][0], "042328", 6) == 0) {
  315. ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP = YES;
  316. EmcOccureByString("042328");
  317. Rtn = 1;
  318. } else if (memcmp(&pSysWarning->WarningCode[i][0], "042200", 6) == 0) {
  319. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP = YES;
  320. EmcOccureByString("042200");
  321. Rtn = 1;
  322. } else if (memcmp(&pSysWarning->WarningCode[i][0], "042201", 6) == 0) {
  323. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL2InputOVP = YES;
  324. EmcOccureByString("042201");
  325. Rtn = 1;
  326. } else if (memcmp(&pSysWarning->WarningCode[i][0], "042202", 6) == 0) {
  327. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL3InputOVP = YES;
  328. EmcOccureByString("042202");
  329. Rtn = 1;
  330. } else if (memcmp(&pSysWarning->WarningCode[i][0], "042267", 6) == 0) {
  331. ShmDcCommonData->PowerAlarmState.StatusBit.PsuFailure = YES;
  332. EmcOccureByString("042267");
  333. Rtn = 1;
  334. } else if (memcmp(&pSysWarning->WarningCode[i][0], "012304", 6) == 0) {
  335. EmcOccureByString("012304");
  336. Rtn = 1;
  337. }
  338. }
  339. if (Rtn == 0) {
  340. ShmDcCommonData->PowerAlarmState.StatusBit.EmergencyStop = NO;
  341. ShmDcCommonData->PowerAlarmState.StatusBit.DoorOpen = NO;
  342. ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP = NO;
  343. ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP = NO;
  344. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP = NO;
  345. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL2InputOVP = NO;
  346. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL3InputOVP = NO;
  347. ShmDcCommonData->PowerAlarmState.StatusBit.PsuFailure = NO;
  348. ReleaseEmsOccureByString(0, "042251");
  349. ReleaseEmsOccureByString(0, "042252");
  350. ReleaseEmsOccureByString(0, "042200");
  351. ReleaseEmsOccureByString(0, "042327");
  352. ReleaseEmsOccureByString(0, "042328");
  353. ReleaseEmsOccureByString(0, "042201");
  354. ReleaseEmsOccureByString(0, "042202");
  355. ReleaseEmsOccureByString(0, "042267");
  356. ReleaseEmsOccureByString(0, "012304");
  357. }
  358. } else {
  359. ShmDcCommonData->PowerAlarmState.StatusBit.EmergencyStop = NO;
  360. ShmDcCommonData->PowerAlarmState.StatusBit.DoorOpen = NO;
  361. ShmDcCommonData->PowerAlarmState.StatusBit.DcInputOVP = NO;
  362. ShmDcCommonData->PowerAlarmState.StatusBit.DcInputUVP = NO;
  363. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL1InputOVP = NO;
  364. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL2InputOVP = NO;
  365. ShmDcCommonData->PowerAlarmState.StatusBit.SystemL3InputOVP = NO;
  366. ShmDcCommonData->PowerAlarmState.StatusBit.PsuFailure = NO;
  367. ReleaseEmsOccureByString(0, "042251");
  368. ReleaseEmsOccureByString(0, "042252");
  369. ReleaseEmsOccureByString(0, "042200");
  370. ReleaseEmsOccureByString(0, "042327");
  371. ReleaseEmsOccureByString(0, "042328");
  372. ReleaseEmsOccureByString(0, "042201");
  373. ReleaseEmsOccureByString(0, "042202");
  374. ReleaseEmsOccureByString(0, "042267");
  375. ReleaseEmsOccureByString(0, "012304");
  376. }
  377. if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton == ABNORMAL) {
  378. pAlarmCode->AlarmEvents.bits.EmergencyStopTrip = YES;
  379. EmcOccureByString("012251");
  380. } else {
  381. ReleaseEmsOccureByString(0, "012251");
  382. }
  383. if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == ABNORMAL) {
  384. pAlarmCode->AlarmEvents.bits.MainPowerBreakerTrip = YES;
  385. EmcOccureByString("012238");
  386. } else {
  387. ReleaseEmsOccureByString(0, "012238");
  388. }
  389. if (ShmPrimaryMcuData->InputDet.bits.SpdDetec == ABNORMAL) {
  390. pAlarmCode->AlarmEvents.bits.SpdTrip = YES;
  391. } else {
  392. pAlarmCode->AlarmEvents.bits.SpdTrip = NO;
  393. }
  394. if (ShmPrimaryMcuData->InputDet.bits.DoorOpen == ABNORMAL) {
  395. pAlarmCode->AlarmEvents.bits.DoorOpen = YES;
  396. EmcOccureByString("012252");
  397. } else {
  398. ReleaseEmsOccureByString(0, "012252");
  399. }
  400. }
  401. void ChkPrimaryStatus(void)
  402. {
  403. static bool leftBtnPush = false;
  404. static bool rightBtnPush = false;
  405. pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  406. struct PrimaryMcuData *ShmPrimaryMcuData = (struct PrimaryMcuData *)GetShmPrimaryMcuData();
  407. struct ChargingInfoData *pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  408. pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
  409. // Check Primary Board status
  410. CheckPrimaryWarm();
  411. if ((pDcChargingInfo->SystemStatus == S_IDLE || pDcChargingInfo->SystemStatus == S_RESERVATION)
  412. && pSysConfig->OfflinePolicy == _OFFLINE_POLICY_NO_CHARGING) {
  413. log_info("Offline policy no charge");
  414. return;;
  415. }
  416. // Show Version
  417. if (ShmPrimaryMcuData->InputDet.bits.Button1 == BTN_PRESS &&
  418. ShmPrimaryMcuData->InputDet.bits.Button2 == BTN_PRESS )
  419. pSysConfig->ShowInformation = YES;
  420. else
  421. pSysConfig->ShowInformation = NO;
  422. if (pSysConfig->ShowInformation)
  423. return;
  424. // Press Left Button
  425. if (ShmPrimaryMcuData->InputDet.bits.Button1 == BTN_PRESS && !leftBtnPush ) {
  426. leftBtnPush = true;
  427. CheckLeftButton();
  428. log_info("left btn down...............................%d %d %d",
  429. pSysInfo->CurGunSelected,pDcChargingInfo->SystemStatus,pSysInfo->SystemPage);
  430. } else if (ShmPrimaryMcuData->InputDet.bits.Button1 == BTN_RELEASE && leftBtnPush) {
  431. leftBtnPush = false;
  432. }
  433. // Press Right Button
  434. if (ShmPrimaryMcuData->InputDet.bits.Button2 == BTN_PRESS && !rightBtnPush ) {
  435. rightBtnPush = true;
  436. CheckRightButton();
  437. log_info("right btn down...............................%d %d %d",
  438. pSysInfo->CurGunSelected,pDcChargingInfo->SystemStatus, pSysInfo->SystemPage);
  439. } else if (ShmPrimaryMcuData->InputDet.bits.Button2 == BTN_RELEASE && rightBtnPush) {
  440. rightBtnPush = false;
  441. }
  442. }