Fix issues with annunciators, help and status area when using higher resolutions.

This commit is contained in:
claudiol 2020-02-12 18:04:29 -05:00
parent 08c0eda2db
commit 799cbcae39
6 changed files with 32 additions and 25 deletions

View file

@ -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<<BITSPERPIXEL)-1) << (BITSPERPIXEL*(ANN_X_COORD % (PIXELS_PER_WORD/4))))) | (color << (BITSPERPIXEL*(ANN_X_COORD % (PIXELS_PER_WORD/4))));
return;
}
else {
@ -815,8 +815,7 @@ void halRedrawHelp(DRAWSURFACE * scr)
nextline = rplStrSize(helptext);
}
DrawTextN(3,
ytop + 2 + (k +
1) * (*halScreen.FontArray[FONT_STATUS])->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);

View file

@ -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

View file

@ -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

View file

@ -43,6 +43,11 @@ typedef uint32_t PTR2NUMBER;
#include <firmware.h>
#include <hal_api.h>
// 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();

View file

@ -8,7 +8,6 @@
#include <ui.h>
#define LCD_TARGET_FREQ 500000
#define LCD_W 160
#define HOZVAL ((LCD_W>>2)-1)
int __lcd_contrast __SYSTEM_GLOBAL__;

View file

@ -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<<BITSPERPIXEL)-1) << (BITSPERPIXEL*(ANN_X_COORD % (PIXELS_PER_WORD))));
for(i = 0; i < 6; ++i) {
ptr = __lcd_buffer + 16 + (LCD_W >> 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);
}