Example #1
0
// *************************************************************************************************
// @fn          check_ucs
// @brief       Check the Unified Clock System.
// @param       none
// @return      none
// *************************************************************************************************
void check_ucs(void) 
{
    // Incremet counter every minute if started
    if(sUcsResetHandling.counter != 0) 
    { 
        sUcsResetHandling.counter++; 
        // Reset UCS twice: one times after one minute and a second time after an other minute
        if((sUcsResetHandling.counter == 2) || (sUcsResetHandling.counter == 3))
        { 
          // Reset UCS
          __disable_interrupt();
          init_ucs();
          __enable_interrupt();
        }
        // Switch off symbol on display after 12 hours (60*12=720 minutes) and stop counter
        if(sUcsResetHandling.counter >= 720) 
        { 
          sUcsResetHandling.counter = 0;
          display_symbol(LCD_SYMB_MAX, SEG_OFF);
        }
    }
        
    // Check UCS for failure
    if((SFRIFG1 & OFIFG) != 0)
    {
        display_symbol(LCD_SYMB_MAX, SEG_ON);
        if(sUcsResetHandling.status == UCSRESET_AUTO) 
        { 
          // Start counter
          sUcsResetHandling.counter = 1;
        }
    }
}
Example #2
0
static void mac_enddlg_reconfig(WindowPtr window, int value)
{
    Session *s = mac_windowsession(window);

    if (value == 0)
	mac_closedlg(window);
    else {
        Config prev_cfg = s->cfg;
        s->cfg = s->temp_cfg;
	mac_closedlg(window);

	/* Pass new config data to the logging module */
	log_reconfig(s->logctx, &s->cfg);

	/*
	 * Flush the line discipline's edit buffer in the
	 * case where local editing has just been disabled.
	 */
	if (s->ldisc)
	    ldisc_send(s->ldisc, NULL, 0, 0);

	/* Change the palette */
	palette_reset(s);

	/* Reinitialise line codepage */
	init_ucs(s);

	/* Pass new config data to the terminal */
	term_reconfig(s->term, &s->cfg);

	/* Pass new config data to the back end */
	if (s->back)
            s->back->reconfig(s->backhandle, &s->cfg);

	/* Screen size changed ? */
	if (s->cfg.height != prev_cfg.height ||
	    s->cfg.width != prev_cfg.width ||
	    s->cfg.savelines != prev_cfg.savelines) {
	    request_resize(s, s->cfg.width, s->cfg.height);
	}

	/* Set the window title */
	if (s->cfg.wintitle[0])
            set_title(s, s->cfg.wintitle);

	/* Scroll bar */
	if (s->cfg.scrollbar != prev_cfg.scrollbar)
           request_resize(s, s->cfg.width, s->cfg.height);

	/* TODO: zoom, font */
    }
}
// *************************************************************************************************
// @fn          mx_sync
// @brief       Mx button (STAR button) handler to do some stuff. Works only if SimpliciTI is off!
// @param       u8 line		LINE2
// @return      none
// *************************************************************************************************
void mx_sync(u8 line)
{
 u8 select;
 s32 Tmp;
         
 // Check for running SimpliciTI
 if(sRFsmpl.mode == SIMPLICITI_OFF)
 {   
    // Init value index
    select = 0; 
    
    clear_display_all();
    
    // Loop values until all are set or user breaks set
    while(1) 
    {
        // Idle timeout: exit without saving 
        if (sys.flag.idle_timeout) break;
        
        // NUM Button (short): save, then exit 
        if (button.flag.num) 
        {
            //Set display update flag
            display.flag.full_update = 1;
            break;
        }

        switch (select)
        {
            case 0: // Set "my defaults"
                    Tmp = 0;
                    display_symbol(LCD_SEG_L2_DP, SEG_OFF);
                    display_chars(LCD_SEG_L2_4_0, (u8 *)"MYDEF", SEG_ON);
                    set_value(&Tmp, 0, 0, 0, 1, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_0, display_NO_YES);
                    if(Tmp == 1) { SetMyDefaults(); }
                    select = 1;
                    break;
            case 1: // Clear number storage and unlock storage 
                    Tmp = 0;
                    display_chars(LCD_SEG_L2_4_0, (u8 *)"CLEAR", SEG_ON);
                    set_value(&Tmp, 0, 0, 0, 1, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_0, display_NO_YES);
                    if(Tmp == 1) { reset_number_storage(); }
                    select = 2;
                    break;
            case 2: // Reset watch 
                    Tmp = 0;
                    display_chars(LCD_SEG_L2_4_0, (u8 *)"RESET", SEG_ON);
                    set_value(&Tmp, 0, 0, 0, 1, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_0, display_NO_YES);
                    if(Tmp == 1) { ResetWatch(); }
                    select = 3;
                    break;
            case 3: // Reset Unified Clock System 
                    Tmp = (s32)sUcsResetHandling.status;
                    display_chars(LCD_SEG_L2_4_0, (u8 *)"OSC-R", SEG_ON);
                    set_value(&Tmp, 0, 0, 0, 3, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_0, display_NO_YES_AUTO_MAN);
                    if(Tmp == 1) // YES
                    { 
                        __disable_interrupt();
                        init_ucs();
                        __enable_interrupt();
                        display_symbol(LCD_SYMB_MAX, SEG_OFF);
                    }
                    if(Tmp == 2) { sUcsResetHandling.status = UCSRESET_AUTO; }
                    if(Tmp == 3) { sUcsResetHandling.status = UCSRESET_MAN; }
                    select = 4;
                    break;
            case 4: // Display software version
                    Tmp = 0;
                    display_chars(LCD_SEG_L2_5_0, (u8 *)" S    ", SEG_ON);                   // "S"
                    display_charSegments(LCD_SEG_L2_3, SEG_C+SEG_D+SEG_E+SEG_F, SEG_ON);    // 1/2 "W"
                    display_charSegments(LCD_SEG_L2_2, SEG_B+SEG_C+SEG_D+SEG_E, SEG_ON);    // 1/2 "W"
                    set_value(&Tmp, 0, 0, 0, 3, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_0, display_SW_Version);
                    select = 0;
                    break;
        }
    }
 }
 // Clear button flag
 button.all_flags = 0;
}