}
}
-/***************************************************************************** */
-
-/* Add a false zero-cross, but make sure to do it only once and only if we are not AC powered */
-void DC_switch_start(void)
-{
- static int already_done = 0;
- if ((already_done == 0) && (zc_cnt == 0)) {
- int ret = add_systick_callback(zero_cross, 10); /* 2 zero-crossing at 50Hz -> 100Hz -> 10ms */
- uprintf(UART0, "Entering forced DC mode on systick callback %d\n", ret);
- already_done = 1;
- } else {
- uprintf(UART0, "DC forced mode not available. On: %d, Zc: %d\n", already_done, zc_cnt);
- }
-}
-
/***************************************************************************** */
void update_internal_temp(void)
SAVE_CONFIG,
RESET_CONFIG,
TEST_FAN,
- TEST_12V,
- TEST_CMDV,
CONF_NB_MENU, /* This one must be the last */
};
static const char* conf_titles[] = {
[SAVE_CONFIG] = "Enregistrer",
[RESET_CONFIG] = "RaZ config",
[TEST_FAN] = "T. Fan",
- [TEST_12V] = "T. DC12V",
- [TEST_CMDV] = "T. Cmd",
};
static uint8_t conf_cur_menu = SAVE_CONFIG;
static uint8_t conf_cur_entry = SAVE_CONFIG;
extern uint8_t force_fan;
-extern int8_t force_cmd;
-extern uint32_t zc_cnt;
-extern void DC_switch_start();
static const char* force_types_str[] = {
[FORCE_TYPE_OFF] = "Off",
uint8_t states[3];
states[0] = force_fan; /* TEST_FAN */
- states[1] = (zc_cnt != 0) ? 1 : 0; /* TEST_12V */
- states[2] = (force_cmd != -1) ? force_cmd : 0; /* TEST_CMDV */
for (i = 0; i < CONF_NB_MENU; i++) {
if (i != conf_cur_entry) {
dprintf(4, 1, "Fan turned %s", ((force_fan == 0) ? "OFF" : "ON"));
sub_menu_level = 1;
break;
- case TEST_12V:
- /* Generate a fake zero-cross detect by calling the handler directly */
- DC_switch_start();
- display_line(4, 1, "DC Test ON");
- display_line(5, 2, "(Reset for OFF)");
- sub_menu_level = 1;
- break;
- case TEST_CMDV:
- display_arrows(4, 6, 10);
- dprintf(5, 1, "Cmd. : %3u %", ((force_cmd >= 0) ? force_cmd : 0));
- if (button & BUTTON_UP) {
- if (force_cmd < 0) {
- force_cmd = 0;
- }
- force_cmd += 5;
- if (force_cmd > 100) {
- force_cmd = 100;
- }
- }
- if (button & BUTTON_DOWN) {
- force_cmd -= 5;
- if (force_cmd < 0 ) {
- force_cmd = -1;
- }
- }
- BUTTONS_ACTS_DEFAULT();
- break;
case SAVE_CONFIG: {
display_line(2, 1, "Sauver config ?");
display_line(5, 1, "Valider = OK");