+ switch (mode) {
+ case MODE_NO_FILTER:
+ case MODE_FILTER_THRES1:
+ /* low threshold, some risk of false positive */
+ if (cpt_filter > 100)
+ detected = 1;
+ break;
+ case MODE_FILTER_THRES2:
+ /* high threshold */
+ if (cpt_filter > 250)
+ detected = 1;
+ break;
+ default:
+ break;
+ }
+
+#ifdef HOST_VERSION
+ /* display values */
+ printf("%d fil_fond=%d fil_harm1=%d fil_other=%d\n",
+ i, fil_fond, fil_harm1, fil_other);
+ printf("%d pow_fond=%d pow_harm1=%d pow_other=%d "
+ "cpt_filter=%d detected=%d\n",
+ i, pow_fond, pow_harm1, pow_other, cpt_filter, detected);
+#else
+ if (detected)
+ LED_ON();
+ else
+ LED_OFF();
+
+ /* if filtering is disabled, just copy the radio input
+ * on the buzzer */
+ if (mode == MODE_NO_FILTER) {
+ if (RADIO_READ())
+ BUZZER_ON();
+ else
+ BUZZER_OFF();
+ }
+ /* with filtering enabled, output a square signal at
+ * 625 hz if beacon is detected */
+ else {
+ if ((detected == 1) && (i & 4))
+ BUZZER_ON();
+ else
+ BUZZER_OFF();
+ }
+#endif