Skip to content

Commit

Permalink
dinmeter update
Browse files Browse the repository at this point in the history
first version working
  • Loading branch information
AH2005NA committed Sep 9, 2024
1 parent 6cbac7c commit 697e05b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 30 deletions.
22 changes: 13 additions & 9 deletions Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ String platformName = "Dial";
// -=-=- ALIASES -=-=-
#define DISP M5Dial.Display
#define UperBtn 0
#define Rotary M5Dial.Encoder
#define Rotarysteps 3
#define PortBpinIN 1
#define PortBpinOUT 2
#define IRLED 2
Expand Down Expand Up @@ -275,9 +277,9 @@ String platformName = "DinMeter";
#define M5LED 19
#define ROTATION
#define USE_EEPROM
#define DTime
#define DTget StickCP2.Rtc
#define RTC //TODO: plus2 has a BM8563 RTC but the class isn't the same, needs work.
//#define DTime
//#define DTget StickCP2.Rtc
//#define RTC //TODO: plus2 has a BM8563 RTC but the class isn't the same, needs work.
#define SDCARD //Requires a custom-built adapter
#define PWRMGMT
#define SPEAKER DinMeter.Speaker
Expand All @@ -288,19 +290,21 @@ String platformName = "DinMeter";
#define PortBpinIN 33
#define PortBpinOUT 32
#define BITMAP DISP.pushImage(0, 0, 240, 135, (uint16_t *)SHARKMatrix);
#define M5_BUTTON_MENU 35
#define M5_BUTTON_HOME 37
#define M5_BUTTON_RST 39
#define BACKLIGHT 27
#define M5_BUTTON_HOME 42
//#define M5_BUTTON_MENU 42
#define Rotary DinMeter.Encoder
#define Rotarysteps 1
#define revRotary
#define BACKLIGHT 9
#define MINBRIGHT 190
#define SD_CLK_PIN 0
#define SD_MISO_PIN 36
#define SD_MOSI_PIN 26
#define SD_CS_PIN -1 //can be -1, but sends a lot of messages of error in serial monitor
#define M5LED_ON HIGH
#define M5LED_OFF LOW
#define SCREEN_WIDTH 80
#define SCREEN_HEIGHT 160
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 135

#endif

Expand Down
35 changes: 20 additions & 15 deletions globalfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,23 @@ int current_proc = 1; // Start in Main Menu mode if no RTC
dimtimer();
return true;
}
#elif defined(DIAL)
M5Dial.update();
int newPosition = M5Dial.Encoder.read();
if (-2 > newPosition) {
M5Dial.Encoder.write(0);
#elif defined(Rotary)
//M5Dial.update();
//DinMeter.update();revRotary
int newPosition = Rotary.read();
if (-Rotarysteps > newPosition) {
Rotary.write(0);
#ifndef revRotary
cursor = cursor - 2;
#endif
dimtimer();
return true;
}
if (2 < newPosition) {
M5Dial.Encoder.write(0);
if (Rotarysteps < newPosition) {
Rotary.write(0);
#ifdef revRotary
cursor = cursor - 2;
#endif
dimtimer();
return true;
}
Expand Down Expand Up @@ -478,7 +484,7 @@ void switcher_button_proc() {
dimtimer();
return true;
}
#else
#elif defined(M5_BUTTON_HOME)
if (digitalRead(M5_BUTTON_HOME) == LOW) {
dimtimer();
return true;
Expand All @@ -491,18 +497,17 @@ void switcher_button_proc() {
bool check_m_press() {
#if defined(AXP)
if (M5.Axp.GetBtnPress()) {
#endif
#if defined(KB)
#elif defined(KB)
M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(',') || M5Cardputer.Keyboard.isKeyPressed('`')) {
#endif
#if defined(DIAL)
#elif defined(DIAL)
M5Dial.update();
auto t = M5Dial.Touch.getDetail();
if (t.isHolding()) {
#endif
#if defined(M5_BUTTON_MENU)
if (digitalRead(M5_BUTTON_MENU) == LOW) {
#elif defined(M5_BUTTON_MENU)
if (digitalRead(M5_BUTTON_MENU) == LOW) {
#else
if(false) {
#endif
return true;
dimtimer();
Expand Down
14 changes: 8 additions & 6 deletions m5stick-shark.ino
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,17 @@ enum irstate {
void check_menu_press() {
#if defined(AXP)
if (M5.Axp.GetBtnPress()) {
#endif
#if defined(KB)
#elif defined(KB)
M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(',') || M5Cardputer.Keyboard.isKeyPressed('`')) {
#endif
#if defined(DIAL)
#elif defined(DIAL)
M5Dial.update();
auto t = M5Dial.Touch.getDetail();
if (t.isHolding()) {
#endif
#if defined(M5_BUTTON_MENU)
#elif defined(M5_BUTTON_MENU)
if (digitalRead(M5_BUTTON_MENU) == LOW) {
#else
if (false) {
#endif
dimtimer();
if (portal_active) {
Expand Down Expand Up @@ -3534,6 +3533,9 @@ void qrmenu_drawmenu() {
#elif defined(DIAL)
auto cfg = M5.config();
M5Dial.begin(cfg, true, false);
#elif defined(DINMETER)
auto cfg = M5.config();
DinMeter.begin(cfg, true);
#else
M5.begin();
#if defined(CoreInk)
Expand Down

0 comments on commit 697e05b

Please sign in to comment.