Exemplo n.º 1
0
bool sensordecision_verifyOk() {
	if (random)
		return true;
	
	bool ok = true;
	
	for (int i=0; i<BOARDNUM_MAX; i++) {
		if (sensorcomms_getBoardStatus((BoardNum)i) != BOARDSTATUS_READY) {
			debug_setLED(ERROR_LED, true);
			printf_P(PSTR("Board %d not ready\n"), i);
			ok = false;
			continue;
		}
		
		sensorcomms_updateBoard((BoardNum)i);
		if (!sensorcomms_waitBoard((BoardNum)i, 1000)) {
			debug_setLED(ERROR_LED, true);
			printf_P(PSTR("Board %d did not respond to an update\n"), i);
			ok = false;
			continue;
		}
	}
	
	return ok;
}
Exemplo n.º 2
0
void controlpanel_debug() {
	bool error_led = false;
	bool estop_led = false;
	bool tick_led = false;
	bool led2 = false;
	bool led3 = false;
	bool cut = false;
	while (true) {
		char ch = controlpanel_promptChar("LED");
		switch (ch) {
			case 'e':
				debug_setLED(ERROR_LED, !error_led);
				error_led = !error_led;
				break;
			case 's':
				debug_setLED(ESTOP_LED, !estop_led);
				estop_led = !estop_led;
				break;
			case 't':
				debug_setLED(TICK_LED, !tick_led);
				tick_led = !tick_led;
				break;
			case '2':
				debug_setLED(OTHER2_LED, !led2);
				led2 = !led2;
				break;
			case '3':
				debug_setLED(OTHER3_LED, !led3);
				led3 = !led3;
				break;
			case 'b':
				cut = !cut;
				debug_cutBuzzer(cut);
				if (cut) {
					printf_P(PSTR("Buzzer has been cut!\n"));
				} else {
					printf_P(PSTR("Buzzer has been enabled!\n"));
				}
				break;
			case 'q':
				debug_setLED(ERROR_LED, false);
				debug_setLED(ESTOP_LED, false);
				debug_setLED(TICK_LED, false);
				debug_setLED(OTHER2_LED, false);
				debug_setLED(OTHER3_LED, false);
				return;
			case '?':
				static const char msg[] PROGMEM =
					"LED commands:\n"
					"  e  - Error LED\n"
					"  s  - Estop LED\n"
					"  t  - Tick LED\n"
					"  2  - LED 2\n"
					"  3  - LED 3\n"
					"  b  - Cut/Uncut Buzzer\n"
					"  q  - Back";
				puts_P(msg);
				break;
			default:
				puts_P(unknown_str);
				break;
		}
	}
}