Пример #1
0
/* move_str returns a string with move m in coordinate notation */
char *move_str(move_bytes m)
{
	static char str[6];
	char c;

	if (m.bits & 32) {
		switch (m.promote) {
			case KNIGHT:
				c = 'n';
				break;
			case BISHOP:
				c = 'b';
				break;
			case ROOK:
				c = 'r';
				break;
			default:
				c = 'q';
				break;
		}
		sprintf(str, "%c%d%c%d%c",
				COL(m.from) + 'A',
				8 - ROW(m.from),
				COL(m.to) + 'A',
				8 - ROW(m.to),
				c);
	}
	else
		sprintf(str, "%c%d%c%d",
				COL(m.from) + 'A',
				8 - ROW(m.from),
				COL(m.to) + 'A',
				8 - ROW(m.to));
	return str;
}
Пример #2
0
inline
static void matrix_make(uint8_t code)
{
    if (!matrix_is_on(ROW(code), COL(code))) {
        matrix[ROW(code)] |= 1<<COL(code);
    }
}
Пример #3
0
static
void
block( int el )
{
    int i, idx = 0, row, col;

    rb->yield();

    /* Find first unknown square */
    for( i = 0 ; i < 9 && !IS_EMPTY( idx = idx_block( el, i ) ) ; ++i )
        ;
    if( i < 9 )
    {
        assert( IS_EMPTY( idx ) );
        row = ROW( idx );
        col = COLUMN( idx );
        for( ++i ; i < 9 ; ++i )
        {
            idx = idx_block( el, i );
            if( IS_EMPTY( idx ) )
            {
                if( ROW( idx ) != row )
                    row = -1;
                if( COLUMN( idx ) != col )
                    col = -1;
            }
        }
        if( 0 <= row )
            exblock( el, row, idx_row );
        if( 0 <= col )
            exblock( el, col, idx_column );
    }
}
Пример #4
0
//----------------------------------------------------------------------------------------------------
void InitMainMenu(void)
{
    InitOsdFrame();

	// Set 2bit sub menu select flag,color & Attrib
    OSDClear(5, 12, 2, 2, 0xFA, BYTE_ATTRIB);
    OSDClear(5, 12, 2, 2, 0x37, BYTE_COLOR);

	// Draw ----------- ·Ö¸ô --------------
    OSDLine(ROW(3), COL(1), LENGTH(23), 0x5c, BYTE_DISPLAY);
    
    // Set Menu Title color
	OSDLine(ROW(4), COL(0), LENGTH(31), 0x40, BYTE_COLOR);

    // Draw Main Window
    COsdFxDrawWindow(8,0,												//WORD usXStart,WORD usYStart,  
    				 _MAINMENU_WIDTH * 12 + 8,_MAINMENU_HEIGHT * 18,	//WORD usXEnd,WORD usYEnd,  
    				 tMainWindowStyle);									//BYTE *pStyle)

    // Draw Adjust Window
    COsdFxDrawWindow(28,		306,									//WORD usXStart,WORD usYStart,  
    				 288,		372,									//WORD usXEnd,WORD usYEnd,  
    				 tAdjustWindowStyle);								//BYTE *pStyle)
    				 
    ShowMode();
}
Пример #5
0
uint8_t matrix_scan(void)
{
    uint16_t code;
    code = serial_recv2();
    if (code == -1) {
#ifdef PC98_LED_CONTROL
        // Before sending command  we have to make sure that there is no unprocessed key in queue
        // otherwise keys will be missed during sending command
        if (pc98_led) {
            pc98_led_set();
            pc98_led = 0;
        }
#endif
        return 0;
    }

    print_hex8(code); print(" ");

    if (code&0x80) {
        // break code
        if (matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] &= ~(1<<COL(code));
        }
    } else {
        // make code
        if (!matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] |=  (1<<COL(code));
        }
    }
    return code;
}
Пример #6
0
inline
static void matrix_break(uint8_t code)
{
    if (matrix_is_on(ROW(code), COL(code))) {
        matrix[ROW(code)] &= ~(1<<COL(code));
    }
}
Пример #7
0
void vsync(DISPMANX_UPDATE_HANDLE_T u, void* arg)
{

    int ret;
    DISPMANX_UPDATE_HANDLE_T    update;

    update = vc_dispmanx_update_start( 10 );
    assert( update );
    ret = vc_dispmanx_element_change_source( update, element, resource[next_resource]);
    assert( ret == 0 );
    ret = vc_dispmanx_update_submit_sync( update );
    assert( ret == 0 );

    if(next_resource != 2) {

        int real_next_resource = next_resource ^ 1;
        next_resource = 2; // use filler if next callback called before this one ends

        // fill image
        int n;
        for (n=0; n<HEIGHT; n+=2) {
            get_packet(ROW(n)+24); // +24 because clock never changes
            memcpy(ROW(n+1)+24, ROW(n)+24, 336); // double it up because the hardware scaler
                                                 // will introduce blurring between lines
        }

        // write to resource
        ret = vc_dispmanx_resource_write_data(  resource[real_next_resource], TYPE, PITCH, image, &image_rect );
        assert( ret == 0 );

        next_resource = real_next_resource; // queue up next real resource

    }
}
Пример #8
0
/**
 * @brief
 *	Refresh rows row_number AND (row_number + 1) in the usb packet
 *	that we'll send to the led device. This function is also in charge
 *	to make the horizontal move and the negative display.
 * @param data Our private structure where all params are located.
 * @param row_number The first row this function is updating.
 * @param decale The number of LED, between 0 and 2, to shift.
 */
static void		cheeky_refresh_row(data_t*		data,
					__u8		row_number,
					__u8		decale)
{
	unsigned int		bitfield;
	char			char_to_print;
	__be32		first_row = 0;
	__be32		second_row = 0;
	__u8			i;
	__s8			hmove;

	data->display_packets[row_number].brighness = GET_BRIGHNESS(data->params);
	data->display_packets[row_number].row_number = row_number * 2;

	/* Updating the usb packet depending on the text buffer */
	for (i = 0; i < 8; ++i)	{
		up(&data->sem_buffer);
		char_to_print =
			data->buffer[(i + data->start_character) % data->length];
		down(&data->sem_buffer);

		bitfield = cheeky_get_bitfield(char_to_print);

		first_row |= ROW(row_number * 2, bitfield) << (3 * (i + 1));
		second_row |= ROW(row_number * 2 + 1, bitfield) << (3 * (i + 1));
	}

	/* If there is a horizontal move, just shift the bits :) */
	hmove = GET_HMOVE(data->params);
	if (hmove & LED_RIGHT_TO_LEFT) {
		first_row >>= decale;
		second_row >>= decale;
	}
Пример #9
0
uint8_t matrix_scan(void)
{
    is_modified = false;

    uint16_t code;
    code = serial_recv2();
    if (code == -1) {
        return 0;
    }

    dprintf("%02X\n", code);
    if (code&0x80) {
        // break code
        if (matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] &= ~(1<<COL(code));
            is_modified = true;
        }
    } else {
        // make code
        if (!matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] |=  (1<<COL(code));
            is_modified = true;
        }
    }
    return code;
}
Пример #10
0
void MFac6500MenuAdj(BYTE ucMode)
{
    // ucMode : _NEXT or _Prev

       BYTE ucNewItem;
    if(ucMode==_INC)
    { 	
    	if(ucOsdState>_MI_FAC_6500_R-1 && ucOsdState<_MI_FAC_6500_B)
    		ucNewItem=ucOsdState+1;
    	else
    		ucNewItem=_MI_FAC_6500;
    }
    else
	{
	    if(ucOsdState>_MI_FAC_6500_R && ucOsdState<_MI_FAC_6500_B+1)
    		ucNewItem=ucOsdState-1;
    	else
    		ucNewItem=_MI_FAC_6500;
	}
    // 1. Clear Current Menu
	OSDLine(ROW(5),COL(16+(ucOsdState-_MI_FAC_6500_R)*6),LENGTH(6),_MENU_NORMAL_COLOR,BYTE_COLOR);


    // 2. Change ucOsdState
    ucOsdState = ucNewItem;

    // 3. Draw New Item
    if(ucOsdState>_MI_FAC_6500_R-1 && ucOsdState<_MI_FAC_6500_B+1)
    	OSDLine(ROW(5),COL(16+(ucOsdState-_MI_FAC_6500_R)*6),LENGTH(6),_MENU_SECECT_COLOR,BYTE_COLOR);
    else
    	SETCOLOR_FACMAINMENU_SELLINE(5,_MENU_SECECT_COLOR);

}
Пример #11
0
void EvalQueen(S8 sq, S8 side) {
    v.gamePhase += 4;
    int att = 0;
    int mob = 0;
 
    /****************************************************************
    *  A queen should not be developed too early                    *
    ****************************************************************/
 
    if (side == WHITE && ROW(sq) > ROW_2) {
        if (isPiece(WHITE, KNIGHT, B1)) v.PositionalThemes[WHITE] -= 2;
        if (isPiece(WHITE, BISHOP, C1)) v.PositionalThemes[WHITE] -= 2;
        if (isPiece(WHITE, BISHOP, F1)) v.PositionalThemes[WHITE] -= 2;
        if (isPiece(WHITE, KNIGHT, G1)) v.PositionalThemes[WHITE] -= 2;
    }
 
    if (side == BLACK && ROW(sq) < ROW_7) {
        if (isPiece(BLACK, KNIGHT, B8)) v.PositionalThemes[BLACK] -= 2;
        if (isPiece(BLACK, BISHOP, C8)) v.PositionalThemes[BLACK] -= 2;
        if (isPiece(BLACK, BISHOP, F8)) v.PositionalThemes[BLACK] -= 2;
        if (isPiece(BLACK, KNIGHT, G8)) v.PositionalThemes[BLACK] -= 2;
    }
 
    /****************************************************************
    *  Collect data about mobility and king attacks                 *
    ****************************************************************/
 
    for (char dir=0;dir<vectors[QUEEN];dir++) {
 
         for (char pos = sq;;) {
 
              pos = pos + vector[QUEEN][dir];
              if (! IS_SQ(pos)) break;
 
              if (b.pieces[pos] == PIECE_EMPTY) {
                 mob++;
                 if ( e.sqNearK[!side] [b.KingLoc[!side] ] [pos] ) ++att;
              }
              else if (b.color[pos] != side) {
                   mob++;
                   if ( e.sqNearK[!side] [b.KingLoc[!side] ] [pos] ) ++att;
                   break;
              }
              else {
                   break;
              }
 
         }
    }
 
    v.mgMob[side] += 1 * (mob-14);
    v.egMob[side] += 2 * (mob-14);
 
    if (att) {
       v.attCnt[side]++;
       v.attWeight[side] += 4*att;
    }
 
}
Пример #12
0
void print(const char *str, int len, int row, int col) {
	if (valid_pos(row, col)) {
		int i;
		int pos = row * WIDTH + col;
		for (i = 0; i < len && valid_pos(ROW(pos), COL(pos)); i++, pos++)
			print_char(str[i], ROW(pos), COL(pos));
	}
}
Пример #13
0
void EraseFromSOLToCursor() {
	int i;

	for (i = 0; i < COLUMN(TermInfo); i++) {
		SCREENCHAR(TermInfo, ROW(TermInfo), i) = ' ';
		FORMATCODE(TermInfo, ROW(TermInfo), i) = FORMATCODE(TermInfo, ROW(TermInfo), 0);
	}
}
Пример #14
0
void NewLine() {
	if (DOUBLELINE(TermInfo)) {
		ROW(TermInfo) = ROW(TermInfo) + 2;
	}
	else {
		ROW(TermInfo)++;
	}
}
Пример #15
0
char *ConstructCursorPositionReport() {
	char *s = ".[##;##R";
	s[2] = (COLUMN(TermInfo)/10) + 48;
	s[3] = (COLUMN(TermInfo)%10) + 48;
	s[5] = (ROW(TermInfo)/10) + 48;
	s[6] = (ROW(TermInfo)%10) + 48;
	return s;
}
Пример #16
0
void Display::update_prearm(uint8_t r)
{
    if (AP_Notify::flags.pre_arm_check) {
        draw_text(COLUMN(0), ROW(r), "Prearm: passed    ");
    } else {
        draw_text(COLUMN(0), ROW(r), "Prearm: failed    ");
    }
}
Пример #17
0
void EraseFromCursorToEOL() {
	int i;

	for (i = COLUMN(TermInfo); i < MAXCOLS; i++) {
		SCREENCHAR(TermInfo, ROW(TermInfo), i) = ' ';
		FORMATCODE(TermInfo, ROW(TermInfo), i) = CURRENTFORMAT(TermInfo);
	}
}
Пример #18
0
void Display::update_ekf(uint8_t r)
{
    if (AP_Notify::flags.ekf_bad) {
        draw_text(COLUMN(0), ROW(r), "EKF:    fail");
    } else {
        draw_text(COLUMN(0), ROW(r), "EKF:    ok  ");
    }
}
Пример #19
0
void Display::update_arm(uint8_t r)
{
    if (AP_Notify::flags.armed) {
        draw_text(COLUMN(0), ROW(r), ">>>>> ARMED! <<<<<");
    } else {
        draw_text(COLUMN(0), ROW(r), "     disarmed     ");
    }
}
Пример #20
0
/*
 * _get_account_coords - fill in all the users that are coordinator for
 *  this account. Also fill in coordinators from parent accounts.
 */
static int
_get_account_coords(pgsql_conn_t *pg_conn, slurmdb_account_rec_t *acct)
{
	DEF_VARS;
	slurmdb_coord_rec_t *coord = NULL;

	if(!acct) {
		error("as/pg: _get_account_coords: account not given");
		return SLURM_ERROR;
	}

	if(!acct->coordinators)
		acct->coordinators = list_create(slurmdb_destroy_coord_rec);

	/* get direct coords */
	query = xstrdup_printf("SELECT user_name FROM %s "
			       "WHERE acct='%s' AND deleted=0",
			       acct_coord_table, acct->name);
	result = DEF_QUERY_RET;
	if(!result)
		return SLURM_ERROR;

	FOR_EACH_ROW {
		coord = xmalloc(sizeof(slurmdb_coord_rec_t));
		list_append(acct->coordinators, coord);
		coord->name = xstrdup(ROW(0));
		coord->direct = 1;
	} END_EACH_ROW;
	PQclear(result);

	/* get parent account coords */
	FOR_EACH_CLUSTER(NULL) {
		if (query)
			xstrcat(query, " UNION ");
		xstrfmtcat(query, "SELECT DISTINCT t0.user_name "
			   "FROM %s AS t0, %s.%s AS t1, %s.%s AS t2 "
			   "WHERE (t1.acct='%s' AND t1.user_name='' "
			   "  AND (t1.lft>t2.lft AND t1.rgt < t2.rgt)) "
			   "  AND t0.deleted=0 AND t0.acct=t2.acct "
			   "  AND t2.acct != '%s'",
			   acct_coord_table, cluster_name, assoc_table,
			   cluster_name, assoc_table, acct->name, acct->name);

	} END_EACH_CLUSTER;

	result = DEF_QUERY_RET;
	if(!result)
		return SLURM_ERROR;

	FOR_EACH_ROW {
		coord = xmalloc(sizeof(slurmdb_coord_rec_t));
		list_append(acct->coordinators, coord);
		coord->name = xstrdup(ROW(0));
		coord->direct = 0;
	} END_EACH_ROW;
	PQclear(result);
	return SLURM_SUCCESS;
}
Пример #21
0
inline
static void register_key(uint8_t key)
{
    if (key&0x80) {
        matrix[ROW(key)] &= ~(1<<COL(key));
    } else {
        matrix[ROW(key)] |=  (1<<COL(key));
    }
}
Пример #22
0
inline int BlackPawnMoves(const BOARD *board, SQUARE orig, MOVE *poss_moves, int nmoves, char noncaptures)
{
    SQUARE dest = orig + ROW_DOWN;
    if(noncaptures && IN_BOARD(dest) && board->squares[dest] == EMPTY){
        if(ROW(dest) == FIRST_ROW){
            if(poss_moves) poss_moves[nmoves] = Move(B_QUEEN, dest, orig);
            nmoves++;
            if(poss_moves) poss_moves[nmoves] = Move(B_KNIGHT, dest, orig);
            nmoves++;
            if(poss_moves) poss_moves[nmoves] = Move(B_ROOK, dest, orig);
            nmoves++;
            if(poss_moves) poss_moves[nmoves] = Move(B_BISHOP, dest, orig);
            nmoves++;
        }else{
            if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
            nmoves++;
            if(ROW(dest) == SIXTH_ROW){
                dest = dest + ROW_DOWN;
                if(IN_BOARD(dest)){
                    if(board->squares[dest] == EMPTY){
                        if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
                        nmoves++;
                    }
                }
            }
        }
    }
    for(int i = 0; b_pawn_capture[i]; i++){
        dest = orig + b_pawn_capture[i];
        if(IN_BOARD(dest)){
            if(board->squares[dest] == EMPTY){
                if(dest == board->en_passant){
                    if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
                    nmoves++;
                }
            }else if(GET_COLOR(board->squares[dest])){
                if(ROW(dest) == FIRST_ROW){
                    if(poss_moves) poss_moves[nmoves] = Move(B_QUEEN, dest, orig);   
                    nmoves++;
                    if(poss_moves) poss_moves[nmoves] = Move(B_KNIGHT, dest, orig);
                    nmoves++;
                    if(poss_moves) poss_moves[nmoves] = Move(B_ROOK, dest, orig);
                    nmoves++;
                    if(poss_moves) poss_moves[nmoves] = Move(B_BISHOP, dest, orig);
                    nmoves++;
                }else{
                    if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
                    nmoves++;
                }
            }
        }
    }
    return nmoves;
}
Пример #23
0
void shortestPathHelper(Node** g,int size, int col)
{
  int i,j;
  int max_move = size*size;
  int path = 0;
  loc n1;
  loc n2;
  if(col == size-2)
    {
      for(i = 0;i<size-1;i++)
	{
	  ROW(n1) = i;
	  COL(n1) = col;
	  g[i][col].dist = max_move;
	  for(j = 0;j<size-1;j++)
	    {
	      ROW(n2) = j;
	      COL(n2) = col+1;
   
	      path = g[ROW(n2)][COL(n2)].dist + dist(g,i,col,j,col+1)+1;
	      if(g[ROW(n1)][COL(n1)].dist > path)
		{

		  g[ROW(n1)][COL(n1)].dist = path;
		  }
	   
   
	    
	    }
 
	}
      return;
    }

  shortestPathHelper(g,size,col+1);
  for(i = 0;i<size-1;i++)
    {
      g[i][col].dist = max_move;
      COL(n1) = col;
      ROW(n1) = i;
      
      for(j = 0;j<size-1;j++)
	{
	  ROW(n2) = j;
	      COL(n2) = col+1;
   
	      path = g[ROW(n2)][COL(n2)].dist + dist(g,i,col,j,col+1);
	      int prev_best = g[ROW(n1)][COL(n1)].dist;
	      g[ROW(n1)][COL(n1)].dist = MIN(prev_best,path);
	    
	}
    }
}
Пример #24
0
uint8_t matrix_scan(void)
{
    is_modified = false;

    uint8_t code;
    code = serial_recv();
    if (!code) return 0;

    debug_hex(code); debug(" ");

    switch (code) {
        case 0xFF:  // reset success: FF 04
            print("reset: ");
            _delay_ms(500);
            code = serial_recv();
            xprintf("%02X\n", code);
            if (code == 0x04) {
                // LED status
                led_set(host_keyboard_leds());
            }
            return 0;
        case 0xFE:  // layout: FE <layout>
            print("layout: ");
            _delay_ms(500);
            xprintf("%02X\n", serial_recv());
            return 0;
        case 0x7E:  // reset fail: 7E 01
            print("reset fail: ");
            _delay_ms(500);
            xprintf("%02X\n", serial_recv());
            return 0;
        case 0x7F:
            // all keys up
            for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
            return 0;
    }

    if (code&0x80) {
        // break code
        if (matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] &= ~(1<<COL(code));
            is_modified = true;
        }
    } else {
        // make code
        if (!matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] |=  (1<<COL(code));
            is_modified = true;
        }
    }
    return code;
}
Пример #25
0
inline int WhitePawnMoves(const BOARD *board, SQUARE orig, MOVE *poss_moves, int nmoves, char noncaptures)
{
    SQUARE dest = orig + ROW_UP;
    if(noncaptures && IN_BOARD(dest) && board->squares[dest] == EMPTY){
        if(ROW(dest) == EIGHT_ROW){            /*Promotions.*/
            if(poss_moves) poss_moves[nmoves] = Move(W_QUEEN, dest, orig);
            nmoves++;
            if(poss_moves) poss_moves[nmoves] = Move(W_KNIGHT, dest, orig);
            nmoves++;
            if(poss_moves) poss_moves[nmoves] = Move(W_ROOK, dest, orig);
            nmoves++;
            if(poss_moves) poss_moves[nmoves] = Move(W_BISHOP, dest, orig);
            nmoves++;
        }else{
            if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
            nmoves++;
            if(ROW(dest) == THIRD_ROW){
                dest = dest + ROW_UP;
                if(IN_BOARD(dest) && board->squares[dest] == EMPTY){
                    if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
                    nmoves++;
                }
            }
        }
    }
    for(int i = 0; w_pawn_capture[i]; i++){
        dest = orig + w_pawn_capture[i];
        if(IN_BOARD(dest)){
            if(board->squares[dest] == EMPTY){
                if(dest == board->en_passant){        /*Captures en Passant.*/
                    if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
                    nmoves++;
                }
            }else if(GET_COLOR(board->squares[dest]) == BLACK){
                if(ROW(dest) == EIGHT_ROW){
                    if(poss_moves) poss_moves[nmoves] = Move(W_QUEEN, dest, orig);
                    nmoves++;
                    if(poss_moves) poss_moves[nmoves] = Move(W_KNIGHT, dest, orig);
                    nmoves++;
                    if(poss_moves) poss_moves[nmoves] = Move(W_ROOK, dest, orig);
                    nmoves++;
                    if(poss_moves) poss_moves[nmoves] = Move(W_BISHOP, dest, orig);
                    nmoves++;
                }else{
                    if(poss_moves) poss_moves[nmoves] = Move(0, dest, orig);
                    nmoves++;
                }
            }
        }
    }
    return nmoves;
}
Пример #26
0
void MFactoryEnterSub(void)
{
    // ucMode : _INC or _DEC
    switch(ucOsdState)
    {
        case _MI_FAC_AUTOCOLOR:    
            CAutoDoWhiteBalance();
            CFacShowNumber(18,2,stAdcData.AdcGain[_RED]);
    		CFacShowNumber(25,2,stAdcData.AdcGain[_GREEN]);
    		CFacShowNumber(31,2,stAdcData.AdcGain[_BLUE]);
    
    		CFacShowNumber(18,3,stAdcData.AdcOffset[_RED]);
    		CFacShowNumber(25,3,stAdcData.AdcOffset[_GREEN]);
    		CFacShowNumber(31,3,stAdcData.AdcOffset[_BLUE]);
            break;

        case _MI_FAC_9300:
        	SETCOLOR_FACMAINMENU_SELLINE(ucOsdState+1-_MI_FAC_AUTOCOLOR,_MENU_NORMAL_COLOR);
        	ucOsdState=_MI_FAC_9300_R;
        	OSDLine(ROW(4), COL(16), LENGTH(5), _MENU_SECECT_COLOR, BYTE_COLOR);			
            break;

        case _MI_FAC_6500:             
            SETCOLOR_FACMAINMENU_SELLINE(ucOsdState+1-_MI_FAC_AUTOCOLOR,_MENU_NORMAL_COLOR);
            ucOsdState=_MI_FAC_6500_R;
            OSDLine(ROW(5), COL(16), LENGTH(5), _MENU_SECECT_COLOR, BYTE_COLOR);         
            break;
        	
        case _MI_FAC_GAIN:           
            SETCOLOR_FACMAINMENU_SELLINE(ucOsdState+1-_MI_FAC_AUTOCOLOR,_MENU_NORMAL_COLOR);
            ucOsdState=_MI_FAC_GAIN_R;
            OSDLine(ROW(2), COL(16), LENGTH(5), _MENU_SECECT_COLOR, BYTE_COLOR);         
            break;
			
        case _MI_FAC_OFFSET: 
			SETCOLOR_FACMAINMENU_SELLINE(ucOsdState+1-_MI_FAC_AUTOCOLOR,_MENU_NORMAL_COLOR);
            ucOsdState=_MI_FAC_OFFSET_R;
            OSDLine(ROW(3), COL(16), LENGTH(5), _MENU_SECECT_COLOR, BYTE_COLOR);         
            break;
            
        case _MI_FAC_BURNIN:	
        	EnterFacBurnin();
			break;

        case _MI_FAC_EXIT: 		
            ExitFacMenu();                      
			break;
    }
}
Пример #27
0
//-----------------------------------------------------------
void EnterFacBurnin(void)
{
	if(GET_BURNIN_STATE()==_BURNIN_ON)
    {	
    	SET_BURNIN_STATE(0);
    	OSDClear(6, 1, 17, 5, 0x00,BYTE_DISPLAY);
    	TextOutCalcWidth(sFacOff,ROW(6),COL(17),5,5*12);
    }
    else
    {
    	SET_BURNIN_STATE(1);
    	OSDClear(6, 1, 17, 5, 0x00,BYTE_DISPLAY);
		TextOutCalcWidth(sFacOn,ROW(6),COL(17),5,5*12);
	}
}
Пример #28
0
v_handleResult
v_handleRenew(
    v_handle *handle)
{
    v_handleServer server;
    v_handleInfo *info;
    c_long idx;
    v_handleInfo *block;

    server = v_handleServer((c_object)handle->server);
    if (server == NULL) {
        return V_HANDLE_ILLEGAL;
    }
    assert(C_TYPECHECK(server,v_handleServer));
    c_mutexLock(&server->mutex);
    if(server->suspended == TRUE) {
        return V_HANDLE_SUSPENDED;
    }
    idx = handle->index;
    if ((idx < 0) || (idx > server->lastIndex)) {
        return V_HANDLE_ILLEGAL;
    }
    block = ((v_handleInfo**)server->handleInfos)[COL(idx)];
    info = &block[ROW(idx)];
    c_mutexLock(&info->mutex);
    c_mutexUnlock(&server->mutex);
    info->count = 0;
    info->serial = (info->serial + 1) % MAXSERIAL;
    handle->serial = info->serial;
    c_mutexUnlock(&info->mutex);

    return V_HANDLE_OK;
}
Пример #29
0
void Display::update_gps(uint8_t r)
{
    static const char * gpsfixname[] = {"Other", "NoGPS","NoFix","2D","3D","DGPS", "RTK f", "RTK F"};
    char msg [DISPLAY_MESSAGE_SIZE];
    const char * fixname;
    switch  (AP_Notify::flags.gps_status) {
        case AP_GPS::NO_GPS:
            fixname = gpsfixname[1];
            break;
        case AP_GPS::NO_FIX:
            fixname = gpsfixname[2];
            break;
        case AP_GPS::GPS_OK_FIX_2D:
            fixname = gpsfixname[3];
            break;
        case AP_GPS::GPS_OK_FIX_3D:
            fixname = gpsfixname[4];
            break;
        case AP_GPS::GPS_OK_FIX_3D_DGPS:
            fixname = gpsfixname[5];
            break;
        case AP_GPS::GPS_OK_FIX_3D_RTK_FLOAT:
            fixname = gpsfixname[6];
            break;
        case AP_GPS::GPS_OK_FIX_3D_RTK_FIXED:
            fixname = gpsfixname[7];
            break;
        default:
            fixname = gpsfixname[0];
            break;
    }
    snprintf(msg, DISPLAY_MESSAGE_SIZE, "GPS:%-5s Sats:%2u", fixname, (unsigned)AP_Notify::flags.gps_num_sats) ;
    draw_text(COLUMN(0), ROW(r), msg);
}
Пример #30
0
void Display::update_text(uint8_t r)
{
    char msg [DISPLAY_MESSAGE_SIZE] = {};
    char txt [NOTIFY_TEXT_BUFFER_SIZE] = {};

    const bool text_is_valid = AP_HAL::millis() - pNotify->_send_text_updated_millis < _send_text_valid_millis;
    if (!text_is_valid) {
        update_text_empty(r);
        return;
    }

    if (_movedelay > 0) {
        _movedelay--;
        return;
    }

    snprintf(txt, sizeof(txt), "%s", pNotify->get_text());

    memset(msg, ' ', sizeof(msg)-1); // leave null termination
    const uint8_t len = strlen(&txt[_mstartpos]);
    const uint8_t to_copy = (len < sizeof(msg)-1) ? len : (sizeof(msg)-1);
    memcpy(msg, &txt[_mstartpos], to_copy);

    if (len <= sizeof(msg)-1) {
        // end-of-message reached; pause scrolling a while
        _movedelay = 4;
        // reset startpos so we start scrolling from the start again:
        _mstartpos = 0;
    } else {
        _mstartpos++;
    }

    draw_text(COLUMN(0), ROW(0), msg);
 }