diff --git a/firmware/hal_screen.c b/firmware/hal_screen.c index 1bd786b..f557aa1 100644 --- a/firmware/hal_screen.c +++ b/firmware/hal_screen.c @@ -23,9 +23,9 @@ void halSetNotification(enum halNotification type, int color) if(type < N_DATARECVD) { unsigned char *scrptr = (unsigned char *)MEM_PHYS_SCREEN; - scrptr += 65; - scrptr += type * 80; - *scrptr = (*scrptr & 0xf) | (color << 4); + scrptr += ANN_X_COORD / (PIXELS_PER_WORD/4); + scrptr += type * (SCREEN_W / (PIXELS_PER_WORD/4)); + *scrptr = (*scrptr & ~(((1<BitmapHeight, + ytop + 2 + (*halScreen.FontArray[FONT_MENU])->BitmapHeight + k * (*halScreen.FontArray[FONT_STATUS])->BitmapHeight, (char *)basetext + currentline, (char *)basetext + nextline, *halScreen.FontArray[FONT_STATUS], 0xf, scr); @@ -828,7 +827,7 @@ void halRedrawHelp(DRAWSURFACE * scr) scr->clipy = ytop + 1; scr->clipy2 = - ytop + 1 + (*halScreen.FontArray[FONT_STATUS])->BitmapHeight; + ytop + 1 + (*halScreen.FontArray[FONT_MENU])->BitmapHeight; uiDrawMenuItem(item, 0xf, scr); @@ -990,8 +989,8 @@ void halRedrawMenu2(DRAWSURFACE * scr) scr->clipy2 = ytop + MENU2_HEIGHT / 2 - 2; for(k = 0; k < 3; ++k) { - scr->clipx = 22 * k; - scr->clipx2 = 22 * k + 20; + scr->clipx = MENU_TAB_WIDTH * k; + scr->clipx2 = MENU_TAB_WIDTH * k + (MENU_TAB_WIDTH-2); item = uiGetMenuItem(m2code, MenuObj, k + MENUPAGE(m2code)); uiDrawMenuItem(item, mcolor, scr); } @@ -1002,15 +1001,15 @@ void halRedrawMenu2(DRAWSURFACE * scr) scr->clipy2 = ybottom - 1; for(k = 0; k < 2; ++k) { - scr->clipx = 22 * k; - scr->clipx2 = 22 * k + 20; + scr->clipx = MENU_TAB_WIDTH * k; + scr->clipx2 = MENU_TAB_WIDTH * k + (MENU_TAB_WIDTH-2); item = uiGetMenuItem(m2code, MenuObj, k + 3 + MENUPAGE(m2code)); uiDrawMenuItem(item, mcolor, scr); } // NOW DO THE NXT KEY - scr->clipx = 22 * k; - scr->clipx2 = 22 * k + 20; + scr->clipx = MENU_TAB_WIDTH * k; + scr->clipx2 = MENU_TAB_WIDTH * k + (MENU_TAB_WIDTH-2); if(nitems == 6) { item = uiGetMenuItem(m2code, MenuObj, 5); diff --git a/firmware/include/target_50g.h b/firmware/include/target_50g.h index 611c54b..bde8e1e 100644 --- a/firmware/include/target_50g.h +++ b/firmware/include/target_50g.h @@ -205,8 +205,7 @@ // USABLE SCREEN SIZE #define SCREEN_WIDTH 131 #define SCREEN_HEIGHT 80 -#define STATUSAREA_X 66 -#define MENU_TAB_WIDTH (((SCREEN_WIDTH-5)/6)+1) +#define PIXELS_PER_WORD 8 // DEFAULT COLOR MODE OF THE SYSTEM #define DEFAULTBITSPERPIXEL 4 @@ -217,6 +216,10 @@ // PHYSICAL SCREEN SIZE #define SCREEN_W 160 #define SCREEN_H 80 +#define ANN_X_COORD 131 +#define ANN_Y_COORD 0 + + // STYLE DEFINITION CONSTANTS #define CAPTIONHEIGHT 7 diff --git a/firmware/include/target_pc.h b/firmware/include/target_pc.h index e146b4b..08506ce 100644 --- a/firmware/include/target_pc.h +++ b/firmware/include/target_pc.h @@ -56,15 +56,15 @@ extern int __usb_timeout; // Target PC uses 50g screen and other capabilities for now // USABLE SCREEN SIZE -#define SCREEN_WIDTH 256 -#define SCREEN_HEIGHT 160 -#define STATUSAREA_X (66*SCREEN_WIDTH)/131 -#define MENU_TAB_WIDTH (((SCREEN_WIDTH-5)/6)+1) +#define SCREEN_WIDTH 131 +#define SCREEN_HEIGHT 80 #define PIXELS_PER_WORD 8 // PHYSICAL SCREEN SIZE -#define SCREEN_W 288 -#define SCREEN_H 160 +#define SCREEN_W 160 +#define SCREEN_H 80 + +#define ANN_X_COORD (SCREEN_WIDTH) // DEFAULT COLOR MODE OF THE SYSTEM #define DEFAULTBITSPERPIXEL 4 diff --git a/firmware/include/ui.h b/firmware/include/ui.h index bf054f7..26c15b7 100644 --- a/firmware/include/ui.h +++ b/firmware/include/ui.h @@ -43,6 +43,11 @@ typedef uint32_t PTR2NUMBER; #include #include +// CONSTANTS THAT DEFINE THE LOOK OF THE USER INTERFACE +#define STATUSAREA_X (66*SCREEN_WIDTH)/131 +#define MENU_TAB_WIDTH (((SCREEN_WIDTH-5)/6)+1) +#define BITSPERPIXEL (32/PIXELS_PER_WORD) + // COMMAND LINE WORDPTR halSaveCmdLine(); diff --git a/firmware/sys/target_50g/lcd.c b/firmware/sys/target_50g/lcd.c index 4d5bdce..d32e1db 100644 --- a/firmware/sys/target_50g/lcd.c +++ b/firmware/sys/target_50g/lcd.c @@ -8,7 +8,6 @@ #include #define LCD_TARGET_FREQ 500000 -#define LCD_W 160 #define HOZVAL ((LCD_W>>2)-1) int __lcd_contrast __SYSTEM_GLOBAL__; diff --git a/qemuscreen.cpp b/qemuscreen.cpp index e6e87f8..0efa133 100644 --- a/qemuscreen.cpp +++ b/qemuscreen.cpp @@ -220,7 +220,7 @@ void QEmuScreen::update() int mask; for(i = 0; i < screen_height; ++i) { mask = 0xf; - ptr = __lcd_buffer + (LCD_W / PIXELS_PER_WORD) * i; + ptr = __lcd_buffer + (LCD_W >> 3) * i; for(j = 0; j < screen_width; ++j) { color = (*ptr & mask) >> ((j & 7) * 4); Pixels[i * screen_width + j]->setBrush(GrayBrush[color]); @@ -233,10 +233,11 @@ void QEmuScreen::update() } } // UPDATE ANNUNCIATORS - mask = 0xf << 12; + mask = (((1<> 3) * i; - color = (*ptr & mask) >> 12; + ptr = __lcd_buffer + ANN_X_COORD / (PIXELS_PER_WORD); + ptr += i * (SCREEN_W / PIXELS_PER_WORD); + color = (*ptr & mask) >> (BITSPERPIXEL*(ANN_X_COORD % (PIXELS_PER_WORD))); Annunciators[i]->setOpacity(((qreal) color) / 15.0); }