Skip to content

Commit

Permalink
make the dial better
Browse files Browse the repository at this point in the history
  • Loading branch information
AH2005NA committed Jun 17, 2024
1 parent cccf419 commit 2e1088b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions localization.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
#define TXT_Song_en "Song enabled"
#define TXT_Savetosd "Save to SD"
#define TXT_Transmit "Transmit"
#define TXT_TOP "Top"
#define TXT_BOTTOM "Bottom"
#endif

#if defined(LANGUAGE_GER)
Expand Down
28 changes: 27 additions & 1 deletion m5stick-shark.ino
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,15 @@ String platformName = "Dial";
#define RTC
#define USE_EEPROM
#define SONG
#define ROTATION
// -=-=- ALIASES -=-=-
#define DISP M5Dial.Display
#define UperBtn 0
#define PortBpinIN 1
#define PortBpinOUT 2
#define IRLED 2
#define BACKLIGHT 9
#define MINBRIGHT 165
#define MINBRIGHT 20
#define SPEAKER M5Dial.Speaker
#define BITMAP DISP.pushImage(0, 0, 240, 240, (uint16_t *)SHARKMatrix);
#define VBAT_PIN 15
Expand Down Expand Up @@ -413,6 +414,12 @@ enum irstate {

#ifdef DIAL

uint8_t CenterText(String Text, uint8_t Textsize) {
Serial.print(sizeof(Text));
//return 120 - ((uint16_t)sizeof(Text)*Textsize*3);
return (240 - ((uint16_t)8*Textsize*6))/2;
}

void drawmenu(MENU thismenu[], int size) {
DISP.setTextSize(SMALL_TEXT);
DISP.fillScreen(BGCOLOR);
Expand Down Expand Up @@ -1757,7 +1764,9 @@ void writeCard() {
/// Rotation MENU ///
MENU rmenu[] = {
{ TXT_BACK, rotation },
{ TXT_BOTTOM, 0 },
{ TXT_RIGHT, 1 },
{ TXT_TOP, 2 },
{ TXT_LEFT, 3 },
};
int rmenu_size = sizeof(rmenu) / sizeof(MENU);
Expand Down Expand Up @@ -3165,9 +3174,17 @@ void writeCard() {
#endif
DISP.fillScreen(BGCOLOR);
DISP.setTextSize(BIG_TEXT);
#if defined(DIAL)
DISP.setCursor(24, 55);
#else
DISP.setCursor(40, 0);
#endif
DISP.println("M5-SHARK");
#if defined(DIAL)
DISP.setCursor(120 - ((uint16_t)sizeof(String(SHARK_VERSION + platformName))*5), 90);
#else
DISP.setCursor(10, 30);
#endif
DISP.setTextSize(SMALL_TEXT);
DISP.printf("%s-%s\n", SHARK_VERSION, platformName);
screenBrightness(brightness);
Expand All @@ -3186,6 +3203,15 @@ void writeCard() {
break;
}
}
#elif defined(DIAL)
DISP.setCursor(10, 110);
DISP.println(TXT_STK_NXT);
DISP.setCursor(10, 130);
DISP.println(TXT_STK_SEL);
DISP.setCursor(10, 150);
DISP.println(TXT_STK_HOME);
while (true) {
}
#else
DISP.println(TXT_STK_NXT);
DISP.println(TXT_STK_SEL);
Expand Down

0 comments on commit 2e1088b

Please sign in to comment.