fsensor.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. #include "Marlin.h"
  2. #include "fsensor.h"
  3. #include <avr/pgmspace.h>
  4. #include "pat9125.h"
  5. #include "stepper.h"
  6. #include "planner.h"
  7. #include "fastio.h"
  8. #include "cmdqueue.h"
  9. #include "ConfigurationStore.h"
  10. //Basic params
  11. #define FSENSOR_CHUNK_LEN 0.64F //filament sensor chunk length 0.64mm
  12. #define FSENSOR_ERR_MAX 17 //filament sensor maximum error count for runout detection
  13. //Optical quality meassurement params
  14. #define FSENSOR_OQ_MAX_ES 6 //maximum error sum while loading (length ~64mm = 100chunks)
  15. #define FSENSOR_OQ_MAX_EM 2 //maximum error counter value while loading
  16. #define FSENSOR_OQ_MIN_YD 2 //minimum yd per chunk (applied to avg value)
  17. #define FSENSOR_OQ_MAX_YD 200 //maximum yd per chunk (applied to avg value)
  18. #define FSENSOR_OQ_MAX_PD 4 //maximum positive deviation (= yd_max/yd_avg)
  19. #define FSENSOR_OQ_MAX_ND 5 //maximum negative deviation (= yd_avg/yd_min)
  20. #define FSENSOR_OQ_MAX_SH 13 //maximum shutter value
  21. const char ERRMSG_PAT9125_NOT_RESP[] PROGMEM = "PAT9125 not responding (%d)!\n";
  22. #define FSENSOR_INT_PIN 63 //filament sensor interrupt pin PK1
  23. #define FSENSOR_INT_PIN_MSK 0x02 //filament sensor interrupt pin mask (bit1)
  24. extern void stop_and_save_print_to_ram(float z_move, float e_move);
  25. extern void restore_print_from_ram_and_continue(float e_move);
  26. extern int8_t FSensorStateMenu;
  27. void fsensor_stop_and_save_print(void)
  28. {
  29. printf_P(PSTR("fsensor_stop_and_save_print\n"));
  30. stop_and_save_print_to_ram(0, 0); //XYZE - no change
  31. }
  32. void fsensor_restore_print_and_continue(void)
  33. {
  34. printf_P(PSTR("fsensor_restore_print_and_continue\n"));
  35. restore_print_from_ram_and_continue(0); //XYZ = orig, E - no change
  36. }
  37. //uint8_t fsensor_int_pin = FSENSOR_INT_PIN;
  38. uint8_t fsensor_int_pin_old = 0;
  39. int16_t fsensor_chunk_len = 0;
  40. //enabled = initialized and sampled every chunk event
  41. bool fsensor_enabled = true;
  42. //runout watching is done in fsensor_update (called from main loop)
  43. bool fsensor_watch_runout = true;
  44. //not responding - is set if any communication error occured durring initialization or readout
  45. bool fsensor_not_responding = false;
  46. //printing saved
  47. bool fsensor_printing_saved = false;
  48. //number of errors, updated in ISR
  49. uint8_t fsensor_err_cnt = 0;
  50. //variable for accumolating step count (updated callbacks from stepper and ISR)
  51. int16_t fsensor_st_cnt = 0;
  52. //last dy value from pat9125 sensor (used in ISR)
  53. int16_t fsensor_dy_old = 0;
  54. //log flag: 0=log disabled, 1=log enabled
  55. uint8_t fsensor_log = 1;
  56. ////////////////////////////////////////////////////////////////////////////////
  57. //filament autoload variables
  58. //autoload feature enabled
  59. bool fsensor_autoload_enabled = true;
  60. //autoload watching enable/disable flag
  61. bool fsensor_watch_autoload = false;
  62. //
  63. uint16_t fsensor_autoload_y;
  64. //
  65. uint8_t fsensor_autoload_c;
  66. //
  67. uint32_t fsensor_autoload_last_millis;
  68. //
  69. uint8_t fsensor_autoload_sum;
  70. ////////////////////////////////////////////////////////////////////////////////
  71. //filament optical quality meassurement variables
  72. //meassurement enable/disable flag
  73. bool fsensor_oq_meassure = false;
  74. //skip-chunk counter, for accurate meassurement is necesary to skip first chunk...
  75. uint8_t fsensor_oq_skipchunk;
  76. //number of samples from start of meassurement
  77. uint8_t fsensor_oq_samples;
  78. //sum of steps in positive direction movements
  79. uint16_t fsensor_oq_st_sum;
  80. //sum of deltas in positive direction movements
  81. uint16_t fsensor_oq_yd_sum;
  82. //sum of errors durring meassurement
  83. uint16_t fsensor_oq_er_sum;
  84. //max error counter value durring meassurement
  85. uint8_t fsensor_oq_er_max;
  86. //minimum delta value
  87. uint16_t fsensor_oq_yd_min;
  88. //maximum delta value
  89. uint16_t fsensor_oq_yd_max;
  90. //sum of shutter value
  91. uint16_t fsensor_oq_sh_sum;
  92. void fsensor_init(void)
  93. {
  94. uint8_t pat9125 = pat9125_init();
  95. printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
  96. uint8_t fsensor = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
  97. fsensor_autoload_enabled=eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED);
  98. fsensor_chunk_len = (int16_t)(FSENSOR_CHUNK_LEN * cs.axis_steps_per_unit[E_AXIS]);
  99. if (!pat9125)
  100. {
  101. fsensor = 0; //disable sensor
  102. fsensor_not_responding = true;
  103. }
  104. else
  105. fsensor_not_responding = false;
  106. if (fsensor)
  107. fsensor_enable();
  108. else
  109. fsensor_disable();
  110. printf_P(PSTR("FSensor %S\n"), (fsensor_enabled?PSTR("ENABLED"):PSTR("DISABLED\n")));
  111. }
  112. bool fsensor_enable(void)
  113. {
  114. uint8_t pat9125 = pat9125_init();
  115. printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
  116. if (pat9125)
  117. fsensor_not_responding = false;
  118. else
  119. fsensor_not_responding = true;
  120. fsensor_enabled = pat9125?true:false;
  121. fsensor_watch_runout = true;
  122. fsensor_oq_meassure = false;
  123. fsensor_err_cnt = 0;
  124. fsensor_dy_old = 0;
  125. eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, fsensor_enabled?0x01:0x00);
  126. FSensorStateMenu = fsensor_enabled?1:0;
  127. return fsensor_enabled;
  128. }
  129. void fsensor_disable(void)
  130. {
  131. fsensor_enabled = false;
  132. eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x00);
  133. FSensorStateMenu = 0;
  134. }
  135. void fsensor_autoload_set(bool State)
  136. {
  137. fsensor_autoload_enabled = State;
  138. eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, fsensor_autoload_enabled);
  139. }
  140. void pciSetup(byte pin)
  141. {
  142. *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin
  143. PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
  144. PCICR |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group
  145. }
  146. void fsensor_autoload_check_start(void)
  147. {
  148. // puts_P(_N("fsensor_autoload_check_start\n"));
  149. if (!fsensor_enabled) return;
  150. if (!fsensor_autoload_enabled) return;
  151. if (fsensor_watch_autoload) return;
  152. if (!pat9125_update_y()) //update sensor
  153. {
  154. fsensor_disable();
  155. fsensor_not_responding = true;
  156. fsensor_watch_autoload = false;
  157. printf_P(ERRMSG_PAT9125_NOT_RESP, 3);
  158. return;
  159. }
  160. puts_P(_N("fsensor_autoload_check_start - autoload ENABLED\n"));
  161. fsensor_autoload_y = pat9125_y; //save current y value
  162. fsensor_autoload_c = 0; //reset number of changes counter
  163. fsensor_autoload_sum = 0;
  164. fsensor_autoload_last_millis = millis();
  165. fsensor_watch_runout = false;
  166. fsensor_watch_autoload = true;
  167. fsensor_err_cnt = 0;
  168. }
  169. void fsensor_autoload_check_stop(void)
  170. {
  171. // puts_P(_N("fsensor_autoload_check_stop\n"));
  172. if (!fsensor_enabled) return;
  173. // puts_P(_N("fsensor_autoload_check_stop 1\n"));
  174. if (!fsensor_autoload_enabled) return;
  175. // puts_P(_N("fsensor_autoload_check_stop 2\n"));
  176. if (!fsensor_watch_autoload) return;
  177. puts_P(_N("fsensor_autoload_check_stop - autoload DISABLED\n"));
  178. fsensor_autoload_sum = 0;
  179. fsensor_watch_autoload = false;
  180. fsensor_watch_runout = true;
  181. fsensor_err_cnt = 0;
  182. }
  183. bool fsensor_check_autoload(void)
  184. {
  185. if (!fsensor_enabled) return false;
  186. if (!fsensor_autoload_enabled) return false;
  187. if (!fsensor_watch_autoload)
  188. {
  189. fsensor_autoload_check_start();
  190. return false;
  191. }
  192. uint8_t fsensor_autoload_c_old = fsensor_autoload_c;
  193. if ((millis() - fsensor_autoload_last_millis) < 25) return false;
  194. fsensor_autoload_last_millis = millis();
  195. if (!pat9125_update_y()) //update sensor
  196. {
  197. fsensor_disable();
  198. fsensor_not_responding = true;
  199. printf_P(ERRMSG_PAT9125_NOT_RESP, 2);
  200. return false;
  201. }
  202. int16_t dy = pat9125_y - fsensor_autoload_y;
  203. if (dy) //? dy value is nonzero
  204. {
  205. if (dy > 0) //? delta-y value is positive (inserting)
  206. {
  207. fsensor_autoload_sum += dy;
  208. fsensor_autoload_c += 3; //increment change counter by 3
  209. }
  210. else if (fsensor_autoload_c > 1)
  211. fsensor_autoload_c -= 2; //decrement change counter by 2
  212. fsensor_autoload_y = pat9125_y; //save current value
  213. }
  214. else if (fsensor_autoload_c > 0)
  215. fsensor_autoload_c--;
  216. if (fsensor_autoload_c == 0) fsensor_autoload_sum = 0;
  217. // puts_P(_N("fsensor_check_autoload\n"));
  218. // if (fsensor_autoload_c != fsensor_autoload_c_old)
  219. // printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum);
  220. // if ((fsensor_autoload_c >= 15) && (fsensor_autoload_sum > 30))
  221. if ((fsensor_autoload_c >= 12) && (fsensor_autoload_sum > 20))
  222. {
  223. // puts_P(_N("fsensor_check_autoload = true !!!\n"));
  224. return true;
  225. }
  226. return false;
  227. }
  228. void fsensor_oq_meassure_start(uint8_t skip)
  229. {
  230. if (!fsensor_enabled) return;
  231. printf_P(PSTR("fsensor_oq_meassure_start\n"));
  232. fsensor_oq_skipchunk = skip;
  233. fsensor_oq_samples = 0;
  234. fsensor_oq_st_sum = 0;
  235. fsensor_oq_yd_sum = 0;
  236. fsensor_oq_er_sum = 0;
  237. fsensor_oq_er_max = 0;
  238. fsensor_oq_yd_min = FSENSOR_OQ_MAX_YD;
  239. fsensor_oq_yd_max = 0;
  240. fsensor_oq_sh_sum = 0;
  241. pat9125_update();
  242. pat9125_y = 0;
  243. fsensor_watch_runout = false;
  244. fsensor_oq_meassure = true;
  245. }
  246. void fsensor_oq_meassure_stop(void)
  247. {
  248. if (!fsensor_enabled) return;
  249. printf_P(PSTR("fsensor_oq_meassure_stop, %hhu samples\n"), fsensor_oq_samples);
  250. printf_P(_N(" st_sum=%u yd_sum=%u er_sum=%u er_max=%hhu\n"), fsensor_oq_st_sum, fsensor_oq_yd_sum, fsensor_oq_er_sum, fsensor_oq_er_max);
  251. printf_P(_N(" yd_min=%u yd_max=%u yd_avg=%u sh_avg=%u\n"), fsensor_oq_yd_min, fsensor_oq_yd_max, (uint16_t)((uint32_t)fsensor_oq_yd_sum * fsensor_chunk_len / fsensor_oq_st_sum), (uint16_t)(fsensor_oq_sh_sum / fsensor_oq_samples));
  252. fsensor_oq_meassure = false;
  253. fsensor_watch_runout = true;
  254. fsensor_err_cnt = 0;
  255. }
  256. const char _OK[] PROGMEM = "OK";
  257. const char _NG[] PROGMEM = "NG!";
  258. bool fsensor_oq_result(void)
  259. {
  260. if (!fsensor_enabled) return true;
  261. printf_P(_N("fsensor_oq_result\n"));
  262. bool res_er_sum = (fsensor_oq_er_sum <= FSENSOR_OQ_MAX_ES);
  263. printf_P(_N(" er_sum = %u %S\n"), fsensor_oq_er_sum, (res_er_sum?_OK:_NG));
  264. bool res_er_max = (fsensor_oq_er_max <= FSENSOR_OQ_MAX_EM);
  265. printf_P(_N(" er_max = %hhu %S\n"), fsensor_oq_er_max, (res_er_max?_OK:_NG));
  266. uint8_t yd_avg = ((uint32_t)fsensor_oq_yd_sum * fsensor_chunk_len / fsensor_oq_st_sum);
  267. bool res_yd_avg = (yd_avg >= FSENSOR_OQ_MIN_YD) && (yd_avg <= FSENSOR_OQ_MAX_YD);
  268. printf_P(_N(" yd_avg = %hhu %S\n"), yd_avg, (res_yd_avg?_OK:_NG));
  269. bool res_yd_max = (fsensor_oq_yd_max <= (yd_avg * FSENSOR_OQ_MAX_PD));
  270. printf_P(_N(" yd_max = %u %S\n"), fsensor_oq_yd_max, (res_yd_max?_OK:_NG));
  271. bool res_yd_min = (fsensor_oq_yd_min >= (yd_avg / FSENSOR_OQ_MAX_ND));
  272. printf_P(_N(" yd_min = %u %S\n"), fsensor_oq_yd_min, (res_yd_min?_OK:_NG));
  273. uint16_t yd_dev = (fsensor_oq_yd_max - yd_avg) + (yd_avg - fsensor_oq_yd_min);
  274. uint16_t yd_qua = 10 * yd_avg / (yd_dev + 1);
  275. printf_P(_N(" yd_dev = %u\n"), yd_dev);
  276. printf_P(_N(" yd_qua = %u\n"), yd_qua);
  277. uint8_t sh_avg = (fsensor_oq_sh_sum / fsensor_oq_samples);
  278. bool res_sh_avg = (sh_avg <= FSENSOR_OQ_MAX_SH);
  279. if (yd_qua >= 8) res_sh_avg = true;
  280. printf_P(_N(" sh_avg = %hhu %S\n"), sh_avg, (res_sh_avg?_OK:_NG));
  281. bool res = res_er_sum && res_er_max && res_yd_avg && res_yd_max && res_yd_min && res_sh_avg;
  282. printf_P(_N("fsensor_oq_result %S\n"), (res?_OK:_NG));
  283. return res;
  284. }
  285. ISR(PCINT2_vect)
  286. {
  287. if (!((fsensor_int_pin_old ^ PINK) & FSENSOR_INT_PIN_MSK)) return;
  288. fsensor_int_pin_old = PINK;
  289. static bool _lock = false;
  290. if (_lock) return;
  291. _lock = true;
  292. int st_cnt = fsensor_st_cnt;
  293. fsensor_st_cnt = 0;
  294. sei();
  295. uint8_t old_err_cnt = fsensor_err_cnt;
  296. uint8_t pat9125_res = fsensor_oq_meassure?pat9125_update():pat9125_update_y();
  297. if (!pat9125_res)
  298. {
  299. fsensor_disable();
  300. fsensor_not_responding = true;
  301. printf_P(ERRMSG_PAT9125_NOT_RESP, 1);
  302. }
  303. if (st_cnt != 0)
  304. { //movement
  305. if (st_cnt > 0) //positive movement
  306. {
  307. if (pat9125_y < 0)
  308. {
  309. if (fsensor_err_cnt)
  310. fsensor_err_cnt += 2;
  311. else
  312. fsensor_err_cnt++;
  313. }
  314. else if (pat9125_y > 0)
  315. {
  316. if (fsensor_err_cnt)
  317. fsensor_err_cnt--;
  318. }
  319. else //(pat9125_y == 0)
  320. if (((fsensor_dy_old <= 0) || (fsensor_err_cnt)) && (st_cnt > (fsensor_chunk_len >> 1)))
  321. fsensor_err_cnt++;
  322. if (fsensor_oq_meassure)
  323. {
  324. if (fsensor_oq_skipchunk)
  325. {
  326. fsensor_oq_skipchunk--;
  327. fsensor_err_cnt = 0;
  328. }
  329. else
  330. {
  331. if (st_cnt == fsensor_chunk_len)
  332. {
  333. if (pat9125_y > 0) if (fsensor_oq_yd_min > pat9125_y) fsensor_oq_yd_min = (fsensor_oq_yd_min + pat9125_y) / 2;
  334. if (pat9125_y >= 0) if (fsensor_oq_yd_max < pat9125_y) fsensor_oq_yd_max = (fsensor_oq_yd_max + pat9125_y) / 2;
  335. }
  336. fsensor_oq_samples++;
  337. fsensor_oq_st_sum += st_cnt;
  338. if (pat9125_y > 0) fsensor_oq_yd_sum += pat9125_y;
  339. if (fsensor_err_cnt > old_err_cnt)
  340. fsensor_oq_er_sum += (fsensor_err_cnt - old_err_cnt);
  341. if (fsensor_oq_er_max < fsensor_err_cnt)
  342. fsensor_oq_er_max = fsensor_err_cnt;
  343. fsensor_oq_sh_sum += pat9125_s;
  344. }
  345. }
  346. }
  347. else //negative movement
  348. {
  349. }
  350. }
  351. else
  352. { //no movement
  353. }
  354. #ifdef DEBUG_FSENSOR_LOG
  355. if (fsensor_log)
  356. {
  357. printf_P(_N("FSENSOR cnt=%d dy=%d err=%hhu %S\n"), st_cnt, pat9125_y, fsensor_err_cnt, (fsensor_err_cnt > old_err_cnt)?_N("NG!"):_N("OK"));
  358. if (fsensor_oq_meassure) printf_P(_N("FSENSOR st_sum=%u yd_sum=%u er_sum=%u er_max=%hhu yd_max=%u\n"), fsensor_oq_st_sum, fsensor_oq_yd_sum, fsensor_oq_er_sum, fsensor_oq_er_max, fsensor_oq_yd_max);
  359. }
  360. #endif //DEBUG_FSENSOR_LOG
  361. fsensor_dy_old = pat9125_y;
  362. pat9125_y = 0;
  363. _lock = false;
  364. return;
  365. }
  366. void fsensor_st_block_begin(block_t* bl)
  367. {
  368. if (!fsensor_enabled) return;
  369. if (((fsensor_st_cnt > 0) && (bl->direction_bits & 0x8)) ||
  370. ((fsensor_st_cnt < 0) && !(bl->direction_bits & 0x8)))
  371. {
  372. if (_READ(63)) _WRITE(63, LOW);
  373. else _WRITE(63, HIGH);
  374. }
  375. }
  376. void fsensor_st_block_chunk(block_t* bl, int cnt)
  377. {
  378. if (!fsensor_enabled) return;
  379. fsensor_st_cnt += (bl->direction_bits & 0x8)?-cnt:cnt;
  380. if ((fsensor_st_cnt >= fsensor_chunk_len) || (fsensor_st_cnt <= -fsensor_chunk_len))
  381. {
  382. if (_READ(63)) _WRITE(63, LOW);
  383. else _WRITE(63, HIGH);
  384. }
  385. }
  386. void fsensor_update(void)
  387. {
  388. if (fsensor_enabled)
  389. {
  390. if (fsensor_printing_saved)
  391. {
  392. fsensor_restore_print_and_continue();
  393. fsensor_printing_saved = false;
  394. fsensor_watch_runout = true;
  395. fsensor_err_cnt = 0;
  396. }
  397. else if (fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX))
  398. {
  399. bool autoload_enabled_tmp = fsensor_autoload_enabled;
  400. fsensor_autoload_enabled = false;
  401. fsensor_stop_and_save_print();
  402. fsensor_printing_saved = true;
  403. fsensor_err_cnt = 0;
  404. fsensor_oq_meassure_start(0);
  405. // st_synchronize();
  406. // for (int axis = X_AXIS; axis <= E_AXIS; axis++)
  407. // current_position[axis] = st_get_position_mm(axis);
  408. /*
  409. current_position[E_AXIS] -= 3;
  410. plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 200 / 60, active_extruder);
  411. st_synchronize();
  412. current_position[E_AXIS] += 3;
  413. plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 200 / 60, active_extruder);
  414. st_synchronize();
  415. */
  416. enquecommand_front_P((PSTR("G1 E-3 F200")));
  417. process_commands();
  418. cmdqueue_pop_front();
  419. st_synchronize();
  420. enquecommand_front_P((PSTR("G1 E3 F200")));
  421. process_commands();
  422. cmdqueue_pop_front();
  423. st_synchronize();
  424. fsensor_oq_meassure_stop();
  425. bool err = false;
  426. err |= (fsensor_oq_er_sum > 1);
  427. err |= (fsensor_oq_yd_sum < (4 * FSENSOR_OQ_MIN_YD));
  428. if (!err)
  429. {
  430. printf_P(PSTR("fsensor_err_cnt = 0\n"));
  431. fsensor_restore_print_and_continue();
  432. fsensor_printing_saved = false;
  433. }
  434. else
  435. {
  436. printf_P(PSTR("fsensor_update - M600\n"));
  437. eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
  438. eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
  439. enquecommand_front_P((PSTR("M600")));
  440. fsensor_watch_runout = false;
  441. }
  442. fsensor_autoload_enabled = autoload_enabled_tmp;
  443. }
  444. }
  445. }
  446. void fsensor_setup_interrupt(void)
  447. {
  448. pinMode(FSENSOR_INT_PIN, OUTPUT);
  449. digitalWrite(FSENSOR_INT_PIN, LOW);
  450. fsensor_int_pin_old = 0;
  451. pciSetup(FSENSOR_INT_PIN);
  452. }