mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[review] revert flasher code
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#define _BOOTLOADER_ITOA_H_
|
||||
|
||||
namespace Utility {
|
||||
|
||||
static char * itoa(int value, char * result, int base);
|
||||
static int versionSum(const char * version, int length);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
#include <ion.h>
|
||||
#include <kandinsky.h>
|
||||
|
||||
namespace Flasher {
|
||||
namespace Display {
|
||||
|
||||
void init() {
|
||||
Ion::Display::pushRectUniform(KDRect(0,0,Ion::Display::Width,Ion::Display::Height), KDColor::RGB24(0xFFFF00));
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(KDRect(0,0,Ion::Display::Width,Ion::Display::Height), KDColor::RGB24(0x5e81ac));
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
ctx->drawString("RECOVERY MODE", KDPoint(10, 10), KDFont::LargeFont, KDColorWhite, KDColor::RGB24(0x5e81ac));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +1,55 @@
|
||||
#include <ion.h>
|
||||
#include <kandinsky.h>
|
||||
#include "image.h"
|
||||
|
||||
namespace Flasher {
|
||||
namespace Display {
|
||||
namespace Display {
|
||||
|
||||
constexpr static int sNumberOfMessages = 5;
|
||||
constexpr static int sNumberOfLanguages = 2;
|
||||
constexpr static int sNumberOfMessages = 5;
|
||||
|
||||
constexpr static const char * sMessages[sNumberOfLanguages][sNumberOfMessages] = {
|
||||
{"RECOVERY MODE",
|
||||
"Your calculator is waiting",
|
||||
"for a new software.",
|
||||
"Follow the instructions",
|
||||
"on your computer to continue."},
|
||||
{"MODE RECUPERATION",
|
||||
"Votre calculatrice attend",
|
||||
"l'installation d'un nouveau logiciel.",
|
||||
"Suivez les instructions sur",
|
||||
"votre ordinateur pour continuer."}
|
||||
};
|
||||
constexpr static const char * sMessages[sNumberOfMessages] = {
|
||||
"RECOVERY MODE",
|
||||
"Your calculator is waiting",
|
||||
"for Upsilon to be installed.",
|
||||
"Follow the instructions",
|
||||
"on your computer to continue.",
|
||||
};
|
||||
|
||||
void init() {
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(screen, KDColor::RGB24(0x2B2B2B));
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
KDCoordinate margin = 30;
|
||||
KDCoordinate currentHeight = margin;
|
||||
|
||||
/* Title */
|
||||
const char * title = sMessages[0];
|
||||
KDSize titleSize = KDFont::LargeFont->stringSize(title);
|
||||
ctx->drawString(title, KDPoint((Ion::Display::Width-titleSize.width())/2, currentHeight),
|
||||
KDFont::LargeFont, KDColorWhite, KDColor::RGB24(0x2B2B2B));
|
||||
currentHeight = (uint16_t)((Ion::Display::Height*2)/3);
|
||||
|
||||
/* Logo */
|
||||
for (int i = 0; i < IMAGE_WIDTH; ++i) {
|
||||
for (int j = 0; j < IMAGE_HEIGHT; ++j) {
|
||||
ctx->setPixel(KDPoint(i+(uint16_t)((Ion::Display::Width-IMAGE_WIDTH)/2),
|
||||
j+(titleSize.height()+margin+15)),
|
||||
KDColor::RGB16(image[i+(j*IMAGE_WIDTH)]));
|
||||
}
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
const char * message;
|
||||
for (int i = 1; i < sNumberOfMessages; ++i) {
|
||||
message = sMessages[i];
|
||||
KDSize messageSize = KDFont::SmallFont->stringSize(message);
|
||||
ctx->drawString(message, KDPoint((Ion::Display::Width-messageSize.width())/2, currentHeight),
|
||||
KDFont::SmallFont, KDColorWhite, KDColor::RGB24(0x2B2B2B));
|
||||
currentHeight += messageSize.height();
|
||||
}
|
||||
}
|
||||
|
||||
void init() {
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(screen, KDColorWhite);
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
KDCoordinate margin = 20;
|
||||
KDCoordinate currentHeight = 0;
|
||||
for (int i = 0; i < sNumberOfLanguages; i++) {
|
||||
currentHeight += margin;
|
||||
const char * title = sMessages[i][0];
|
||||
KDSize titleSize = KDFont::LargeFont->stringSize(title);
|
||||
ctx->drawString(title, KDPoint((Ion::Display::Width-titleSize.width())/2, currentHeight), KDFont::LargeFont);
|
||||
currentHeight += 2*titleSize.height();
|
||||
for (int j = 1; j < sNumberOfMessages; j++) {
|
||||
const char * message = sMessages[i][j];
|
||||
KDSize messageSize = KDFont::SmallFont->stringSize(message);
|
||||
ctx->drawString(message, KDPoint((Ion::Display::Width-messageSize.width())/2, currentHeight), KDFont::SmallFont);
|
||||
currentHeight += messageSize.height();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ void ion_main(int argc, const char * const argv[]) {
|
||||
Ion::USB::enable();
|
||||
while (!Ion::USB::isEnumerated()) {
|
||||
}
|
||||
Ion::USB::DFU(false);
|
||||
Ion::USB::DFU(false, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user