Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compatible with esp-s3-dev #19

Merged
merged 6 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ In order to build and upload the Watchy from cmd line :

```bash
export SKETCH="electrowatch.ino"

# v2
export FQBN="esp32:esp32:watchy:Revision=v20,PartitionScheme=huge_app,UploadSpeed=921600,DebugLevel=none"
export PORT="/dev/cu.wchusbserial56230332171"

# v3
export FQBN="esp32:esp32:esp32s3:FlashSize=8M,PartitionScheme=default_8MB,UploadSpeed=921600,DebugLevel=none,EraseFlash=none"
export PORT="/dev/cu.usbmodem14101"
```

You may need to replace the `--port` with your own.
Expand Down Expand Up @@ -63,3 +69,11 @@ screen ${PORT} 115200
```

to exit `ctrl a + k`

### Reset

Install [esptool.py](https://docs.espressif.com/projects/esptool/en/latest/esp32/installation.html)

```bash
esptool.py --port ${PORT} erase_flash
```
18 changes: 12 additions & 6 deletions src/Electrowatch.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#include "Electrowatch.h"

#ifdef ARDUINO_ESP32S3_DEV
#define ACTIVE_LOW_OVER 0
#else
#define ACTIVE_LOW_OVER 1
#endif

const uint8_t BATTERY_SEGMENT_WIDTH = 7;
const uint8_t BATTERY_SEGMENT_HEIGHT = 11;
const uint8_t BATTERY_SEGMENT_SPACING = 9;
Expand Down Expand Up @@ -438,7 +444,7 @@ void Watchy7SEG::upButton() {
}
showMenu(menuIndex, true);
} else if (guiState == WATCHFACE_STATE) {
showJoke();
return;
}
}

Expand All @@ -450,7 +456,7 @@ void Watchy7SEG::downButton() {
}
showMenu(menuIndex, true);
} else if (guiState == WATCHFACE_STATE) {
return;
showJoke();
}
}

Expand Down Expand Up @@ -495,22 +501,22 @@ void Watchy7SEG::handleButtonPress() {
timeout = true;
} else {
// Menu Button
if (digitalRead(MENU_BTN_PIN) == 1) {
if (digitalRead(MENU_BTN_PIN) == ACTIVE_LOW_OVER) {
lastTimeout = millis();
menuButton();
// Back Button
} else if (digitalRead(BACK_BTN_PIN) == 1) {
} else if (digitalRead(BACK_BTN_PIN) == ACTIVE_LOW_OVER) {
lastTimeout = millis();
backButton();
if (guiState == MAIN_MENU_STATE || guiState == FAST_OPT_STATE) { // exit to watch face if already in menu
break; // leave loop
}
// Up Button
} else if (digitalRead(UP_BTN_PIN) == 1) {
} else if (digitalRead(UP_BTN_PIN) == ACTIVE_LOW_OVER) {
lastTimeout = millis();
upButton();
// Down Button
} else if (digitalRead(DOWN_BTN_PIN) == 1) {
} else if (digitalRead(DOWN_BTN_PIN) == ACTIVE_LOW_OVER) {
lastTimeout = millis();
downButton();
}
Expand Down
Loading