ParameterSet.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. /*--------------------------------------------------------------------------------------
  2. * @file ParameterSet.c
  3. * @author ZhangJing
  4. * @version base on stm32f0x
  5. * @date 2015.09.11
  6. * @brief 参数设置数据处理
  7. ---------------------------------------------------------------------------------------*/
  8. #include "stm32f10x_gpio.h"
  9. #include "TypeDefine.h"
  10. #include "FlashSetup.h"
  11. #include "FM31256.h"
  12. #include "ParameterSet.h"
  13. uint8_t paramRecordBuf[PARAMETER_DATA_BYTES];//参数数据数组
  14. uint8_t paramTransferBuf[PARAMETER_DATA_BYTES];//中转参数
  15. /*************************************************************************************
  16. * Function: ReadParameterRecord
  17. * Object: 读取参数数据
  18. * 输入: 无
  19. * 输出: 无
  20. * 备注: 1、根据地址PARAMSET_DATA_START_ADDR读取参数存储区,并将值赋给setParamInfo结构体
  21. * 2�uint8_t tempIndex = 0;临时索引变量
  22. * 3、uint8_t tempRes = 0;操作返回状态
  23. **************************************************************************************/
  24. void ReadParameterRecord( void )
  25. {
  26. uint8_t tempIndex = 0;
  27. // uint8_t tempRes = 0;
  28. uint8_t i,a=0;
  29. FlashReadOperate( paramRecordBuf,PARAMETER_DATA_BYTES,PARAMSET_DATA_START_ADDR );
  30. for( i = 0; i < 16 ; i++ )
  31. {
  32. //setParamInfo.deviceID[i] = paramRecordBuf[tempIndex++];
  33. a=paramRecordBuf[tempIndex++];
  34. }
  35. setParamInfo.password[0] = paramRecordBuf[tempIndex++];
  36. setParamInfo.password[1] = paramRecordBuf[tempIndex++];
  37. setParamInfo.password[2] = paramRecordBuf[tempIndex++];
  38. for( i = 0; i < 3; i++ )
  39. {
  40. setParamInfo.password[i] = 0;
  41. }
  42. /*
  43. setParamInfo.pwmSetValue[0] = paramRecordBuf[tempIndex++];
  44. setParamInfo.pwmSetValue[1] = paramRecordBuf[tempIndex++];
  45. setParamInfo.pwmSetValue[2] = paramRecordBuf[tempIndex++];
  46. setParamInfo.pwmSetValue[3] = paramRecordBuf[tempIndex++];
  47. for( i = 0; i < 4; i++ )
  48. {
  49. if( setParamInfo.pwmSetValue[i] > 9 )
  50. {
  51. setParamInfo.pwmSetValue[i] = 0;
  52. }
  53. }
  54. runParamInfo.pwmSetValue = setParamInfo.pwmSetValue[0];
  55. runParamInfo.pwmSetValue *= 10;
  56. runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[1];
  57. runParamInfo.pwmSetValue *= 10;
  58. runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[2];
  59. runParamInfo.pwmSetValue *= 10;
  60. runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[3];
  61. if( runParamInfo.pwmSetValue < 200 || runParamInfo.pwmSetValue >1000)
  62. {
  63. runParamInfo.pwmSetValue = 200;
  64. }
  65. runParamInfo.pwmSetValue = 1000;//test*/
  66. for( i = 0; i < 9 ; i++ )//住院号最大值为9位
  67. {
  68. paramTransferBuf[i] = paramRecordBuf[tempIndex++];
  69. // paramTransferBuf[i]=0;
  70. setParamInfo.hospitalNO[i]=paramTransferBuf[i];
  71. }
  72. for( i = 0 ; i < 3; i++ )//病区最大值为3位
  73. {
  74. paramTransferBuf[i] = paramRecordBuf[tempIndex++];
  75. // paramTransferBuf[i]=0;
  76. setParamInfo.sickroom[i] =paramTransferBuf[i];
  77. }
  78. for( i = 0 ; i < 3 ; i++ )//病床最大值为3位
  79. {
  80. paramTransferBuf[i] = paramRecordBuf[tempIndex++];
  81. // paramTransferBuf[i]=0;
  82. setParamInfo.bedNO[i]=paramTransferBuf[i];
  83. }
  84. /*for( i = 0; i < 10 ; i++ )//住院号最大值为10位
  85. {
  86. setParamInfo.hospitalNO[i] = paramRecordBuf[tempIndex++];
  87. if( setParamInfo.hospitalNO[i] > 9 )
  88. {
  89. setParamInfo.hospitalNO[i] = 0;
  90. }
  91. }
  92. for( i = 0 ; i < 3; i++ )//病区最大值为3位
  93. {
  94. setParamInfo.sickroom[i] = paramRecordBuf[tempIndex++];
  95. if( setParamInfo.sickroom[i] > 9 )
  96. {
  97. setParamInfo.sickroom[i] = 0;
  98. }
  99. }
  100. for( i = 0 ; i < 3 ; i++ )//病床最大值为3位
  101. {
  102. setParamInfo.bedNO[i] = paramRecordBuf[tempIndex++];
  103. if( setParamInfo.bedNO[i] > 9 )
  104. {
  105. setParamInfo.bedNO[i] = 0;
  106. }
  107. }*/
  108. setParamInfo.totalDose = paramRecordBuf[tempIndex++];
  109. setParamInfo.totalDose <<= 8;
  110. setParamInfo.totalDose += paramRecordBuf[tempIndex++];
  111. if( setParamInfo.totalDose > 999 )
  112. {
  113. setParamInfo.totalDose = 0;
  114. }
  115. setParamInfo.firstDose = paramRecordBuf[tempIndex++];
  116. setParamInfo.firstDose <<= 8;
  117. setParamInfo.firstDose += paramRecordBuf[tempIndex++];
  118. if( setParamInfo.firstDose > 99 )
  119. {
  120. setParamInfo.firstDose = 0;
  121. }
  122. setParamInfo.continueDose1 = paramRecordBuf[tempIndex++];
  123. setParamInfo.continueDose1 <<= 8;
  124. setParamInfo.continueDose1 += paramRecordBuf[tempIndex++];
  125. if( setParamInfo.continueDose1 > 500 )
  126. {
  127. setParamInfo.continueDose1 = 0;
  128. }
  129. setParamInfo.superaddition1 = paramRecordBuf[tempIndex++];
  130. setParamInfo.superaddition1 <<= 8;
  131. setParamInfo.superaddition1 += paramRecordBuf[tempIndex++];
  132. if( setParamInfo.superaddition1 > 100 )
  133. {
  134. setParamInfo.superaddition1 = 0;
  135. }
  136. setParamInfo.lockTime1 = paramRecordBuf[tempIndex++];
  137. setParamInfo.lockTime1 <<= 8;
  138. setParamInfo.lockTime1 += paramRecordBuf[tempIndex++];
  139. if( setParamInfo.lockTime1 >= 100 )
  140. {
  141. setParamInfo.lockTime1 = 1;
  142. }
  143. setParamInfo.limitDose1 = paramRecordBuf[tempIndex++];
  144. setParamInfo.limitDose1 <<= 8;
  145. setParamInfo.limitDose1 += paramRecordBuf[tempIndex++];
  146. if( setParamInfo.limitDose1 > 200 )
  147. {
  148. setParamInfo.limitDose1 = 90;
  149. }
  150. setParamInfo.continueDose2 = paramRecordBuf[tempIndex++];
  151. setParamInfo.continueDose2 <<= 8;
  152. setParamInfo.continueDose2 += paramRecordBuf[tempIndex++];
  153. if( setParamInfo.continueDose2 > 99 )
  154. {
  155. setParamInfo.continueDose2 = 0;
  156. }
  157. setParamInfo.superaddition2 = paramRecordBuf[tempIndex++];
  158. setParamInfo.superaddition2 <<= 8;
  159. setParamInfo.superaddition2 += paramRecordBuf[tempIndex++];
  160. if( setParamInfo.superaddition2 > 99 )
  161. {
  162. setParamInfo.superaddition2 = 0;
  163. }
  164. setParamInfo.lockTime2 = paramRecordBuf[tempIndex++];
  165. setParamInfo.lockTime2 <<= 8;
  166. setParamInfo.lockTime2 += paramRecordBuf[tempIndex++];
  167. if( ( setParamInfo.lockTime2 > 99 ) || ( setParamInfo.lockTime2 == 0 ) )
  168. {
  169. setParamInfo.lockTime2 = 1;
  170. }
  171. setParamInfo.limitDose2 = paramRecordBuf[tempIndex++];
  172. setParamInfo.limitDose2 <<= 8;
  173. setParamInfo.limitDose2 += paramRecordBuf[tempIndex++];
  174. if( setParamInfo.limitDose2 > 999 )
  175. {
  176. setParamInfo.limitDose2 = 0;
  177. }
  178. EngineeringModeValue.sickroomQty = paramRecordBuf[tempIndex++];
  179. if( ( EngineeringModeValue.sickroomQty < 1 ) || ( EngineeringModeValue.sickroomQty > 3 ) )
  180. {
  181. EngineeringModeValue.sickroomQty = 3;
  182. }
  183. verifyInfo.sickroom = 0;
  184. for( i = 0 ; i < ( EngineeringModeValue.sickroomQty - 1 ) ; i++ )
  185. {
  186. verifyInfo.sickroom += setParamInfo.sickroom[i];
  187. verifyInfo.sickroom *= 10;
  188. }
  189. verifyInfo.sickroom += setParamInfo.sickroom[i];//最后一位不用乘10倍
  190. EngineeringModeValue.networkState = paramRecordBuf[tempIndex++];
  191. if( EngineeringModeValue.networkState > ENGINEERINGMODE_OFF )
  192. {
  193. EngineeringModeValue.networkState = 0;//0开1关,默认开
  194. }
  195. EngineeringModeValue.bedNOQty = paramRecordBuf[tempIndex++];
  196. if( ( EngineeringModeValue.bedNOQty < 1 ) || ( EngineeringModeValue.bedNOQty > 3 ) )
  197. {
  198. EngineeringModeValue.bedNOQty = 3;
  199. }
  200. verifyInfo.bedNO = 0;
  201. for( i = 0 ; i < ( EngineeringModeValue.bedNOQty - 1 ) ; i++ )
  202. {
  203. verifyInfo.bedNO += setParamInfo.bedNO[i];
  204. verifyInfo.bedNO *= 10;
  205. }
  206. verifyInfo.bedNO += setParamInfo.bedNO[i];
  207. EngineeringModeValue.evaluateState = paramRecordBuf[tempIndex++];
  208. if( EngineeringModeValue.evaluateState > 1 )
  209. {
  210. EngineeringModeValue.evaluateState = 0;//0开1关,默认开
  211. }
  212. EngineeringModeValue.selfcontrol = paramRecordBuf[tempIndex++];
  213. EngineeringModeValue.selfcontrol <<= 8;
  214. EngineeringModeValue.selfcontrol += paramRecordBuf[tempIndex++];
  215. if( EngineeringModeValue.selfcontrol > 100 )
  216. {
  217. EngineeringModeValue.selfcontrol = 100;
  218. }
  219. EngineeringModeValue.seachState = paramRecordBuf[tempIndex++];
  220. if( EngineeringModeValue.seachState > 1 )
  221. {
  222. EngineeringModeValue.seachState = 0;//0开1关,默认开
  223. }
  224. EngineeringModeValue.hospitalNOQty = paramRecordBuf[tempIndex++];
  225. if( ( EngineeringModeValue.hospitalNOQty < 1 ) || ( EngineeringModeValue.hospitalNOQty > 10 ) )
  226. {
  227. EngineeringModeValue.hospitalNOQty = 9;
  228. }
  229. verifyInfo.hospitalNO = 0;
  230. for( i = 0 ; i < ( EngineeringModeValue.hospitalNOQty - 1 ) ; i++ )
  231. {
  232. verifyInfo.hospitalNO += setParamInfo.hospitalNO[i];
  233. verifyInfo.hospitalNO *= 10;
  234. }
  235. verifyInfo.hospitalNO += setParamInfo.hospitalNO[i];//最后一位不用乘10倍
  236. EngineeringModeValue.passwordState = paramRecordBuf[tempIndex++];
  237. if( EngineeringModeValue.passwordState > ENGINEERINGMODE_OFF )
  238. {
  239. EngineeringModeValue.passwordState = ENGINEERINGMODE_ON;//0开1关,默认开
  240. }
  241. EngineeringModeValue.deviceAlarm = paramRecordBuf[tempIndex++];
  242. if( EngineeringModeValue.deviceAlarm > 1 )
  243. {
  244. EngineeringModeValue.deviceAlarm = 0;//0开1关,默认开
  245. }
  246. EngineeringModeValue.silenceState = paramRecordBuf[tempIndex++];
  247. if( EngineeringModeValue.silenceState > 1 )
  248. {
  249. EngineeringModeValue.silenceState = 0;//0开1关,默认开
  250. }
  251. EngineeringModeValue.bubbleAlarm = paramRecordBuf[tempIndex++];
  252. if( EngineeringModeValue.bubbleAlarm > 1 )
  253. {
  254. EngineeringModeValue.bubbleAlarm = 0;//0开1关,默认开
  255. }
  256. EngineeringModeValue.closedState = paramRecordBuf[tempIndex++];
  257. if( EngineeringModeValue.closedState > 1 )
  258. {
  259. EngineeringModeValue.closedState = 0;//0开1关,默认开
  260. }
  261. EngineeringModeValue.automatic = paramRecordBuf[tempIndex++];
  262. if( EngineeringModeValue.automatic > 1 )
  263. {
  264. EngineeringModeValue.automatic = 1;//0开1关,默认关
  265. }
  266. EngineeringModeValue.jamAlarm = paramRecordBuf[tempIndex++];
  267. if( EngineeringModeValue.jamAlarm > 1 )
  268. {
  269. EngineeringModeValue.jamAlarm = 0;//0开1关,默认开
  270. }
  271. //---------增加压力显示开关-------------------------
  272. EngineeringModeValue.pressure_switch = paramRecordBuf[tempIndex++];
  273. if( EngineeringModeValue.pressure_switch > 1 )
  274. {
  275. EngineeringModeValue.pressure_switch = 0; //0开1关,默认开
  276. }
  277. /*************增加测试开关***************/
  278. EngineeringModeValue.test = paramRecordBuf[tempIndex++];
  279. if(EngineeringModeValue.test > 1)
  280. {
  281. EngineeringModeValue.test = 0; //0开1关,默认开
  282. }
  283. /* if(paramRecordBuf[PARAMETER_DATA_BYTES-1] == 1)
  284. {
  285. }*/
  286. }
  287. /*************************************************************************************
  288. * Function: WriteParameterRecord
  289. * Object: 写入参数数据
  290. * 输入: 无
  291. * 输出: 无
  292. * 备注: 1、将setParamInfo结构体中的参数赋值给paramRecordBuf数组,并进行flash存储
  293. * 2�uint8_t tempIndex = 0;临时索引变量
  294. **************************************************************************************/
  295. void WriteParameterRecord( void )
  296. {
  297. uint8_t tempIndex = 0;
  298. uint8_t i;
  299. for( i = 0; i < 16 ; i++ )
  300. {
  301. paramRecordBuf[tempIndex++] = setParamInfo.deviceID[i];
  302. }
  303. realTimeData.deviceID = 0;
  304. for( i = 0; i < 15 ; i++ )
  305. {
  306. realTimeData.deviceID += setParamInfo.deviceID[i];
  307. realTimeData.deviceID *= 10;
  308. }
  309. realTimeData.deviceID += setParamInfo.deviceID[15];
  310. paramRecordBuf[tempIndex++] = setParamInfo.password[0];
  311. paramRecordBuf[tempIndex++] = setParamInfo.password[1];
  312. paramRecordBuf[tempIndex++] = setParamInfo.password[2];
  313. /*
  314. paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[0];
  315. paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[1];
  316. paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[2];
  317. paramRecordBuf[tempIndex++] = setParamInfo.pwmSetValue[3];
  318. runParamInfo.pwmSetValue = setParamInfo.pwmSetValue[0];
  319. runParamInfo.pwmSetValue *= 10;
  320. runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[1];
  321. runParamInfo.pwmSetValue *= 10;
  322. runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[2];
  323. runParamInfo.pwmSetValue *= 10;
  324. runParamInfo.pwmSetValue += setParamInfo.pwmSetValue[3];*/
  325. for( i = 0 ; i < 9 ; i++ )
  326. {
  327. if( i < EngineeringModeValue.hospitalNOQty )
  328. {
  329. paramRecordBuf[tempIndex++] = setParamInfo.hospitalNO[i];
  330. }
  331. else
  332. {
  333. paramRecordBuf[tempIndex++] = 0;
  334. }
  335. }
  336. for( i = 0 ; i < 3 ; i++ )
  337. {
  338. if( i < EngineeringModeValue.sickroomQty )
  339. {
  340. paramRecordBuf[tempIndex++] = setParamInfo.sickroom[i];
  341. }
  342. else
  343. {
  344. paramRecordBuf[tempIndex++] = 0;
  345. }
  346. }
  347. for( i = 0 ; i < 3 ; i++ )
  348. {
  349. if( i < EngineeringModeValue.bedNOQty )
  350. {
  351. paramRecordBuf[tempIndex++] = setParamInfo.bedNO[i];
  352. }
  353. else
  354. {
  355. paramRecordBuf[tempIndex++] = 0;
  356. }
  357. }
  358. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.totalDose & 0xff00) >>8 );
  359. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.totalDose & 0x00ff );
  360. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.firstDose & 0xff00) >>8 );
  361. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.firstDose & 0x00ff );
  362. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.continueDose1 & 0xff00) >>8 );
  363. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.continueDose1 & 0x00ff );
  364. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.superaddition1 & 0xff00) >>8 );
  365. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.superaddition1 & 0x00ff );
  366. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.lockTime1 & 0xff00) >>8 );
  367. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.lockTime1 & 0x00ff );
  368. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.limitDose1 & 0xff00) >>8 );
  369. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.limitDose1 & 0x00ff );
  370. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.continueDose2 & 0xff00) >>8 );
  371. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.continueDose2 & 0x00ff );
  372. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.superaddition2 & 0xff00) >>8 );
  373. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.superaddition2 & 0x00ff );
  374. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.lockTime2 & 0xff00) >>8 );
  375. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.lockTime2 & 0x00ff );
  376. paramRecordBuf[tempIndex++] = (uint8_t)( ( setParamInfo.limitDose2 & 0xff00) >>8 );
  377. paramRecordBuf[tempIndex++] = (uint8_t)( setParamInfo.limitDose2 & 0x00ff );
  378. paramRecordBuf[tempIndex++] = EngineeringModeValue.sickroomQty;
  379. paramRecordBuf[tempIndex++] = EngineeringModeValue.networkState;
  380. paramRecordBuf[tempIndex++] = EngineeringModeValue.bedNOQty;
  381. paramRecordBuf[tempIndex++] = EngineeringModeValue.evaluateState;
  382. paramRecordBuf[tempIndex++] = (uint8_t)( ( EngineeringModeValue.selfcontrol & 0xff00 ) >>8 );
  383. paramRecordBuf[tempIndex++] = (uint8_t)( EngineeringModeValue.selfcontrol & 0x00ff );
  384. paramRecordBuf[tempIndex++] = EngineeringModeValue.seachState;
  385. paramRecordBuf[tempIndex++] = EngineeringModeValue.hospitalNOQty;
  386. paramRecordBuf[tempIndex++] = EngineeringModeValue.passwordState;
  387. paramRecordBuf[tempIndex++] = EngineeringModeValue.deviceAlarm;
  388. paramRecordBuf[tempIndex++] = EngineeringModeValue.silenceState;
  389. paramRecordBuf[tempIndex++] = EngineeringModeValue.bubbleAlarm;
  390. paramRecordBuf[tempIndex++] = EngineeringModeValue.closedState;
  391. paramRecordBuf[tempIndex++] = EngineeringModeValue.automatic;
  392. paramRecordBuf[tempIndex++] = EngineeringModeValue.jamAlarm;
  393. paramRecordBuf[tempIndex++] = EngineeringModeValue.pressure_switch; //增加压力显示开关
  394. paramRecordBuf[tempIndex++] = EngineeringModeValue.test; //新增测试开关
  395. for(; tempIndex < PARAMETER_DATA_BYTES ; tempIndex++ )
  396. {
  397. paramRecordBuf[tempIndex] = 0xff;
  398. }
  399. paramRecordBuf[126] = 0x0A;
  400. FlashWriteOperate( paramRecordBuf,PARAMETER_DATA_BYTES,PARAMSET_DATA_START_ADDR );
  401. // Write_Multi31256RAM( SYSPARMA31256_DATA_START_ADDR ,paramRecordBuf,PARAMETER_DATA_BYTES );
  402. }
  403. /*************************************************************************************
  404. * Function: WriteInitParameterRecord
  405. * Object: 写入参数数据
  406. * 输入: 工程开关置位
  407. * 输出: 无
  408. * 备注:
  409. **************************************************************************************/
  410. void WriteInitParameterRecord( void )
  411. {
  412. uint8_t tempIndex = 0;
  413. uint8_t i;
  414. for( i = 0; i < 16 ; i++ )
  415. {
  416. setParamInfo.deviceID[i] = 0;
  417. paramRecordBuf[tempIndex++] = setParamInfo.deviceID[i];
  418. }
  419. realTimeData.deviceID = 0;
  420. for( i = 0; i < 15 ; i++ )
  421. {
  422. setParamInfo.deviceID[i] = 0;
  423. realTimeData.deviceID += setParamInfo.deviceID[i];
  424. realTimeData.deviceID *= 10;
  425. }
  426. realTimeData.deviceID += setParamInfo.deviceID[15];
  427. setParamInfo.password[0] = 0;
  428. setParamInfo.password[1] = 0;
  429. setParamInfo.password[2] = 0;
  430. paramRecordBuf[tempIndex++] = setParamInfo.password[0];
  431. paramRecordBuf[tempIndex++] = setParamInfo.password[1];
  432. paramRecordBuf[tempIndex++] = setParamInfo.password[2];
  433. for( i = 0 ; i < 9 ; i++ )
  434. {
  435. if( i < EngineeringModeValue.hospitalNOQty )
  436. {
  437. setParamInfo.hospitalNO[i] = 0;
  438. paramRecordBuf[tempIndex++] = setParamInfo.hospitalNO[i];
  439. }
  440. else
  441. {
  442. paramRecordBuf[tempIndex++] = 0;
  443. }
  444. }
  445. for( i = 0 ; i < 3 ; i++ )
  446. {
  447. if( i < EngineeringModeValue.sickroomQty )
  448. {
  449. setParamInfo.sickroom[i] = 0;
  450. paramRecordBuf[tempIndex++] = setParamInfo.sickroom[i];
  451. }
  452. else
  453. {
  454. paramRecordBuf[tempIndex++] = 0;
  455. }
  456. }
  457. for( i = 0 ; i < 3 ; i++ )
  458. {
  459. if( i < EngineeringModeValue.bedNOQty )
  460. {
  461. setParamInfo.bedNO[i] = 0;
  462. paramRecordBuf[tempIndex++] = setParamInfo.bedNO[i];
  463. }
  464. else
  465. {
  466. paramRecordBuf[tempIndex++] = 0;
  467. }
  468. }
  469. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.totalDose & 0xff00) >>8 );
  470. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.totalDose & 0x00ff );
  471. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.firstDose & 0xff00) >>8 );
  472. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.firstDose & 0x00ff );
  473. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.continueDose1 & 0xff00) >>8 );
  474. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.continueDose1 & 0x00ff );
  475. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.superaddition1 & 0xff00) >>8 );
  476. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.superaddition1 & 0x00ff );
  477. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.lockTime1 & 0xff00) >>8 );
  478. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.lockTime1 & 0x00ff );
  479. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.limitDose1 & 0xff00) >>8 );
  480. paramRecordBuf[tempIndex++] = 1 ;//(uint8_t)( setParamInfo.limitDose1 & 0x00ff );
  481. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.continueDose2 & 0xff00) >>8 );
  482. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.continueDose2 & 0x00ff );
  483. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.superaddition2 & 0xff00) >>8 );
  484. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.superaddition2 & 0x00ff );
  485. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.lockTime2 & 0xff00) >>8 );
  486. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.lockTime2 & 0x00ff );
  487. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( ( setParamInfo.limitDose2 & 0xff00) >>8 );
  488. paramRecordBuf[tempIndex++] = 0 ;//(uint8_t)( setParamInfo.limitDose2 & 0x00ff );
  489. paramRecordBuf[tempIndex++] = 3 ;//EngineeringModeValue.sickroomQty;
  490. paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.networkState;
  491. paramRecordBuf[tempIndex++] = 3 ;//EngineeringModeValue.bedNOQty;
  492. paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.evaluateState;
  493. paramRecordBuf[tempIndex++] = 1 ;//(uint8_t)( ( EngineeringModeValue.selfcontrol & 0xff00 ) >>8 );
  494. paramRecordBuf[tempIndex++] = 00;//(uint8_t)( EngineeringModeValue.selfcontrol & 0x00ff );
  495. paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.seachState;
  496. paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.hospitalNOQty;
  497. paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.passwordState;
  498. paramRecordBuf[tempIndex++] = 0 ;//EngineeringModeValue.deviceAlarm;
  499. paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.silenceState;
  500. paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.bubbleAlarm;
  501. paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.closedState;
  502. paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.automatic;
  503. paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.jamAlarm;
  504. paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.pressure_switch; //增加压力显示开关
  505. paramRecordBuf[tempIndex++] = 1 ;//EngineeringModeValue.test; //新增测试开关
  506. for(; tempIndex < PARAMETER_DATA_BYTES ; tempIndex++ )
  507. {
  508. paramRecordBuf[tempIndex] = 0xff;
  509. }
  510. paramRecordBuf[126] = 0x0A;
  511. FlashWriteOperate( paramRecordBuf,PARAMETER_DATA_BYTES,PARAMSET_DATA_START_ADDR );
  512. }