Skip to content

Commit

Permalink
Add dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
armel committed May 8, 2022
1 parent 900d7b6 commit 34a452c
Show file tree
Hide file tree
Showing 26 changed files with 4,066 additions and 1,993 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

The ICSMeter project allows to equip the IC-705, IC-7300 and IC-9700 produced by ICOM, with a needle S-Meter ! The S-Meter allows to measure the S signal, the Po power and the SWR. It also displays the current frequency, mode and filter.

![ICSMeter S](https://github.com/armel/ICSMeter/blob/main/img/S.png)
![ICSMeter S](https://github.com/armel/ICSMeter/blob/main/img/S_Classic.png)

![ICSMeter S](https://github.com/armel/ICSMeter/blob/main/img/S_Dark.png)

![ICSMeter PWR](https://github.com/armel/ICSMeter/blob/main/img/PWR.png)

Expand Down Expand Up @@ -202,14 +204,15 @@ The following options are available :
| -------------------- |:-----------------------------------------:|
| Measured Values | Set Measured Values (PWR, S or SWR) |
| Transverter Mode | Set Transverter Mode (OFF, LO1 ~ LO5) |
| Themes | Set Themes (CLASSIC ~ DARK) |
| Brightness | Set Brightness (0 ~ 100%) |
| Beep | Set Beep (0 ~ 100%) |
| Screensaver | Set Screensaver TimeOut (1 ~ 60 min) |
| IP Address | Display your IP |
| Shutdown | Shutdown your M5Stack (even if in charge) |
| Exit | Menu Exit |

> Measured Values, Transverter Mode, Brightness, Beep and Screensaver are preserved at the next restart.
> Measured Values, Transverter Mode, Themes, Brightness, Beep and Screensaver are preserved at the next restart.
# Using the Bin Loader (power user only...)

Expand Down
Binary file modified img/PWR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/S.png
Binary file not shown.
Binary file added img/SMeterMiddleClassic_optimize_10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleClassic_optimize_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleClassic_optimize_10.tiff
Binary file not shown.
Binary file added img/SMeterMiddleClassic_optimize_100.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleClassic_optimize_100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleClassic_optimize_100.tiff
Binary file not shown.
Binary file added img/SMeterMiddleDark_optimize_10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleDark_optimize_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleDark_optimize_10.tiff
Binary file not shown.
Binary file added img/SMeterMiddleDark_optimize_100.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleDark_optimize_100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SMeterMiddleDark_optimize_100.tiff
Binary file not shown.
Binary file removed img/SMeterMiddle_optimize_10.jpg
Binary file not shown.
Binary file removed img/SMeterMiddle_optimize_100.jpg
Binary file not shown.
Binary file modified img/SWR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/S_Classic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/S_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/Settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/ICSMeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void setup()
transverter = preferences.getUInt("transverter", 0);
beep = preferences.getUInt("beep", 0);
screensaver = preferences.getUInt("screensaver", 60);
theme = preferences.getUInt("theme", 0);

// Bin Loader
binLoader();
Expand All @@ -60,8 +61,6 @@ void setup()

setBrightness(map(brightness, 1, 100, 1, 254));
M5.Lcd.setRotation(1);
M5.Lcd.fillScreen(TFT_BACK);

viewGUI();

if(IC_MODEL == 705 && IC_CONNECT == BT)
Expand Down
26 changes: 21 additions & 5 deletions src/ICSMeter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) F4HWN Armel. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#define VERSION "0.1.4"
#define VERSION "0.1.5"
#define AUTHOR "F4HWN"
#define NAME "ICSMeter"

Expand All @@ -22,6 +22,22 @@
#define DEBUG 0

// Color
typedef struct __attribute__((__packed__))
{
uint8_t r;
uint8_t g;
uint8_t b;
} colorType;

uint16_t TFT_BACK = 0x0000;
uint16_t TFT_FRONT = 0x0000;

const colorType TFT_BACK_CLASSIC = {255, 248, 236};
const colorType TFT_FRONT_CLASSIC = {0, 0, 0};

const colorType TFT_BACK_DARK = {0, 0, 0};
const colorType TFT_FRONT_DARK = {255, 255, 255};

#define TFT_MODE_BORDER M5.Lcd.color565(115, 135, 159)
#define TFT_MODE_BACK M5.Lcd.color565(24, 57, 92)

Expand All @@ -30,10 +46,8 @@
#define TFT_MENU_SELECT M5.Lcd.color565(255, 255, 255)

// Needle
#define TFT_BACK M5.Lcd.color565(255, 248, 236)
#define TFT_MODE M5.Lcd.color565(84, 103, 143)
#define TFT_NEDDLE_1 M5.Lcd.color565(241, 120, 100)
#define TFT_NEDDLE_2 M5.Lcd.color565(241, 170, 170)
#define TFT_NEDDLE_2 M5.Lcd.color565(241, 140, 120)

// Web site Screen Capture stuff
#define GET_unknown 0
Expand Down Expand Up @@ -63,6 +77,7 @@ int8_t measure = 1;
int8_t beep = 0;
int8_t transverter = 0;
int8_t screensaver = 0;
int8_t theme = 0;
uint8_t brightness = 64;
uint8_t htmlGetRequest;

Expand Down Expand Up @@ -108,8 +123,9 @@ String binFilename[128];
uint8_t binIndex = 0;

// Menu
const char *settings[] = {"Measured Values", "Transverter Mode", "Brightness", "Beep", "Screensaver", "IP Address", "Shutdown", "Exit"};
const char *settings[] = {"Measured Values", "Transverter Mode", "Themes", "Brightness", "Beep", "Screensaver", "IP Address", "Shutdown", "Exit"};
const char *choiceMeasures[] = {"PWR", "S", "SWR"};
const char *choiceThemes[] = {"CLASSIC", "DARK"};
const char *choiceBrightness[] = {"BRIGHTNESS"};
const char *choiceBeep[] = {"BEEP LEVEL"};
const char *choiceScreensaver[] = {"TIMEOUT"};
Expand Down
92 changes: 72 additions & 20 deletions src/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ void callbackWifiOff(WiFiEvent_t event, WiFiEventInfo_t info)
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
}

// Reset color
void resetColor()
{
switch (theme)
{
case 0:
TFT_BACK = M5.Lcd.color565(TFT_BACK_CLASSIC.r, TFT_BACK_CLASSIC.g, TFT_BACK_CLASSIC.b);
TFT_FRONT = M5.Lcd.color565(TFT_FRONT_CLASSIC.r, TFT_FRONT_CLASSIC.g, TFT_FRONT_CLASSIC.b);
break;

case 1:
TFT_BACK = M5.Lcd.color565(TFT_BACK_DARK.r, TFT_BACK_DARK.g, TFT_BACK_DARK.b);
TFT_FRONT = M5.Lcd.color565(TFT_FRONT_DARK.r, TFT_FRONT_DARK.g, TFT_FRONT_DARK.b);
break;
}
}

// Print battery
void viewBattery()
{
Expand All @@ -49,8 +66,14 @@ void viewBattery()
if (batteryLevel != batteryLevelOld || batteryCharging != batteryCharginglOld)
{

M5.Lcd.drawJpg(smeterTop, sizeof(smeterTop), 0, 0, 320, 20);

if(theme == 0)
{
M5.Lcd.drawJpg(smeterTopClassic, sizeof(smeterTopClassic), 0, 0, 320, 20);
}
else
{
M5.Lcd.drawJpg(smeterTopDark, sizeof(smeterTopDark), 0, 0, 320, 20);
}
// Settings
M5.Lcd.setFont(0);
M5.Lcd.setTextDatum(CC_DATUM);
Expand All @@ -77,21 +100,21 @@ void viewBattery()
batteryLevelOld = batteryLevel;
batteryCharginglOld = batteryCharging;

M5.Lcd.drawRect(294, 4, 20, 12, TFT_BLACK);
M5.Lcd.drawRect(313, 7, 4, 6, TFT_BLACK);
M5.Lcd.fillRect(296, 6, batteryLevel, 8, TFT_BLACK);
M5.Lcd.drawRect(294, 4, 20, 12, TFT_FRONT);
M5.Lcd.drawRect(313, 7, 4, 6, TFT_FRONT);
M5.Lcd.fillRect(296, 6, batteryLevel, 8, TFT_FRONT);

if (batteryCharging)
{
M5.Lcd.setTextColor(TFT_BLACK);
M5.Lcd.setTextColor(TFT_FRONT);
M5.Lcd.setFont(0);
M5.Lcd.setTextDatum(CC_DATUM);
M5.Lcd.setTextPadding(0);
M5.Lcd.drawString("+", 290, 11);
}
else
{
M5.Lcd.setTextColor(TFT_BLACK);
M5.Lcd.setTextColor(TFT_FRONT);
M5.Lcd.setFont(0);
M5.Lcd.setTextDatum(CR_DATUM);
M5.Lcd.setTextPadding(0);
Expand All @@ -104,12 +127,29 @@ void viewBattery()
// View GUI
void viewGUI()
{
M5.Lcd.drawJpg(smeterTop, sizeof(smeterTop), 0, 0, 320, 20);
if (IC_MODEL == 705)
M5.Lcd.drawJpg(smeterMiddle10, sizeof(smeterMiddle10), 0, 20, 320, 140);

resetColor();

M5.Lcd.fillScreen(TFT_BACK);

if(theme == 0)
{
M5.Lcd.drawJpg(smeterTopClassic, sizeof(smeterTopClassic), 0, 0, 320, 20);
if (IC_MODEL == 705)
M5.Lcd.drawJpg(smeterMiddleClassic10, sizeof(smeterMiddleClassic10), 0, 20, 320, 140);
else
M5.Lcd.drawJpg(smeterMiddleClassic100, sizeof(smeterMiddleClassic100), 0, 20, 320, 140);
M5.Lcd.drawJpg(smeterBottomClassic, sizeof(smeterBottomClassic), 0, 160, 320, 80);
}
else
M5.Lcd.drawJpg(smeterMiddle100, sizeof(smeterMiddle100), 0, 20, 320, 140);
M5.Lcd.drawJpg(smeterBottom, sizeof(smeterBottom), 0, 160, 320, 80);
{
M5.Lcd.drawJpg(smeterTopDark, sizeof(smeterTopDark), 0, 0, 320, 20);
if (IC_MODEL == 705)
M5.Lcd.drawJpg(smeterMiddleDark10, sizeof(smeterMiddleDark10), 0, 20, 320, 140);
else
M5.Lcd.drawJpg(smeterMiddleDark100, sizeof(smeterMiddleDark100), 0, 20, 320, 140);
M5.Lcd.drawJpg(smeterBottomDark, sizeof(smeterBottomDark), 0, 160, 320, 80);
}
}

void clearData()
Expand Down Expand Up @@ -181,10 +221,21 @@ void needle(float_t angle, uint16_t a = 0, uint16_t b = 200, uint16_t c = 0, uin
c = 160 + x;
d = 220 - y;

if (IC_MODEL == 705)
M5.Lcd.drawJpg(smeterMiddle10, sizeof(smeterMiddle10), 0, 20, 320, 130);

if(theme == 0)
{
if (IC_MODEL == 705)
M5.Lcd.drawJpg(smeterMiddleClassic10, sizeof(smeterMiddleClassic10), 0, 20, 320, 130);
else
M5.Lcd.drawJpg(smeterMiddleClassic100, sizeof(smeterMiddleClassic100), 0, 20, 320, 130);
}
else
M5.Lcd.drawJpg(smeterMiddle100, sizeof(smeterMiddle100), 0, 20, 320, 130);
{
if (IC_MODEL == 705)
M5.Lcd.drawJpg(smeterMiddleDark10, sizeof(smeterMiddleDark10), 0, 20, 320, 130);
else
M5.Lcd.drawJpg(smeterMiddleDark100, sizeof(smeterMiddleDark100), 0, 20, 320, 130);
}

// M5.Lcd.drawFastHLine(0, 150, 320, TFT_BLACK);

Expand All @@ -207,9 +258,10 @@ void value(String valString, uint8_t x = 160, uint8_t y = 180)

M5.Lcd.setTextDatum(CC_DATUM);
M5.Lcd.setFont(&stencilie16pt7b);
M5.Lcd.setTextPadding(190);
M5.Lcd.setTextColor(TFT_BLACK, TFT_BACK);
valString.replace(".", ",");
//M5.Lcd.setFont(&YELLOWCRE8pt7b);
M5.Lcd.setTextPadding(190);
M5.Lcd.setTextColor(TFT_FRONT, TFT_BACK);
M5.Lcd.drawString(valString, x, y);
}
}
Expand All @@ -225,7 +277,7 @@ void subValue(String valString, uint8_t x = 160, uint8_t y = 206)
M5.Lcd.setFont(&YELLOWCRE8pt7b);
M5.Lcd.setTextPadding(160);
//M5.Lcd.setTextColor(TFT_BLACK, TFT_RED);
M5.Lcd.setTextColor(TFT_BLACK, TFT_BACK);
M5.Lcd.setTextColor(TFT_FRONT, TFT_BACK);
// valString.replace(".", ",");
M5.Lcd.drawString(valString, x, y);
}
Expand All @@ -249,7 +301,7 @@ void viewMeasure()
{
if (measure == j)
{
M5.Lcd.setTextColor(TFT_BLACK);
M5.Lcd.setTextColor(TFT_FRONT);
reset = true;
}
else
Expand Down Expand Up @@ -847,7 +899,7 @@ boolean checkConnection()
M5.Lcd.setTextDatum(CC_DATUM);
M5.Lcd.setFont(&stencilie16pt7b);
M5.Lcd.setTextPadding(194);
M5.Lcd.setTextColor(TFT_BLACK, TFT_BACK);
M5.Lcd.setTextColor(TFT_FRONT, TFT_BACK);
M5.Lcd.drawString(message, 160, 180);
vTaskDelay(750);
M5.Lcd.drawString("", 160, 180);
Expand Down
Loading

0 comments on commit 34a452c

Please sign in to comment.