Skip to content

Commit

Permalink
Cosmetic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
OtherCrashOverride committed Jul 27, 2018
1 parent eed70f5 commit 9c0cee3
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static void DisplayMessage(const char* message)
{
UG_FontSelect(&FONT_8X12);
short left = (320 / 2) - (strlen(message) * 9 / 2);
short top = (240 / 2) - (12 / 2);
short top = (240 / 2) + 8 + (12 / 2) + 16;
UG_SetForecolor(C_BLACK);
UG_SetBackcolor(C_WHITE);
UG_FillFrame(0, top, 319, top + 12, C_WHITE);
Expand All @@ -200,10 +200,14 @@ static void DisplayProgress(int percent)
const int FILL_WIDTH = WIDTH * (percent / 100.0f);

short left = (320 / 2) - (WIDTH / 2);
short top = (240 / 2) - (12 / 2) + 16;
short top = (240 / 2) - (HEIGHT / 2) + 16;
UG_FillFrame(left - 1, top - 1, left + WIDTH + 1, top + HEIGHT + 1, C_WHITE);
UG_DrawFrame(left - 1, top - 1, left + WIDTH + 1, top + HEIGHT + 1, C_BLACK);
UG_FillFrame(left, top, left + FILL_WIDTH, top + HEIGHT, C_GREEN);

if (FILL_WIDTH > 0)
{
UG_FillFrame(left, top, left + FILL_WIDTH, top + HEIGHT, C_GREEN);
}

//UpdateDisplay();
}
Expand Down Expand Up @@ -463,10 +467,6 @@ void flash_firmware(const char* fullPath)
FirmwareDescription[FIRMWARE_DESCRIPTION_SIZE - 1] = 0;

printf("FirmwareDescription='%s'\n", FirmwareDescription);

//DisplayMessage(FirmwareDescription);
//DisplayFooter("[Start]");
//UG_TextboxSetText(&window1, TXB_ID_0, FirmwareDescription);
DisplayHeader(FirmwareDescription);
//UpdateDisplay();

Expand All @@ -485,11 +485,17 @@ void flash_firmware(const char* fullPath)
indicate_error();
}

ui_draw_image((320 / 2) - (TILE_WIDTH / 2), (16 + 16 + 16),
const uint16_t tileLeft = (320 / 2) - (TILE_WIDTH / 2);
const uint16_t tileTop = (16 + 16 + 16);
ui_draw_image(tileLeft, tileTop,
TILE_WIDTH, TILE_HEIGHT, tileData);

free(tileData);

// Tile border
UG_DrawFrame(tileLeft - 1, tileTop - 1, tileLeft + TILE_WIDTH, tileTop + TILE_HEIGHT, C_BLACK);
UpdateDisplay();

// start to begin, b back
DisplayMessage("[START]");
DisplayFooter("[B] Cancel");
Expand Down Expand Up @@ -520,7 +526,7 @@ void flash_firmware(const char* fullPath)
//UpdateDisplay();


DisplayMessage("VERIFY");
DisplayMessage("Verifying ...");


const int ERASE_BLOCK_SIZE = 4096;
Expand Down Expand Up @@ -682,7 +688,7 @@ void flash_firmware(const char* fullPath)
if (eraseBlocks * ERASE_BLOCK_SIZE < length) ++eraseBlocks;

// Display
sprintf(tempstring, "ERASE: [%d] BLOCKS=%#04x", parts_count, eraseBlocks);
sprintf(tempstring, "Erasing ... (%d)", parts_count);

printf("%s\n", tempstring);
DisplayProgress(0);
Expand All @@ -706,7 +712,7 @@ void flash_firmware(const char* fullPath)
for (int offset = 0; offset < length; offset += ERASE_BLOCK_SIZE)
{
// Display
sprintf(tempstring, "WRITE: [%d] %#08x", parts_count, offset);
sprintf(tempstring, "Writing (%d)", parts_count);

printf("%s\n", tempstring);
DisplayProgress((float)offset / (float)(length - ERASE_BLOCK_SIZE) * 100.0f);
Expand Down Expand Up @@ -899,6 +905,9 @@ static void ui_draw_page(char** files, int fileCount, int currentItem)

free(fullPath);

// Tile border
//UG_DrawFrame(imageLeft - 1, top + 1, imageLeft + TILE_WIDTH, top + 2 + TILE_HEIGHT, C_BLACK);

//UG_TextboxSetText(&window1, id, displayStrings[line]);
UG_FontSelect(&FONT_8X12);
UG_PutString(textLeft, top + 2 + 2 + 16, displayStrings[line]);
Expand Down

0 comments on commit 9c0cee3

Please sign in to comment.