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

add basic button support #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 src/Watchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void Watchy::handleButtonPress() {
} else if (guiState == FW_UPDATE_STATE) {
showMenu(menuIndex, false); // exit to menu if already in app
} else if (guiState == WATCHFACE_STATE) {
button1();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

Suggested change
button1();
handleButton2Press();

This lines up with the function naming pattern that already exists, handleButtonPress.

Also, this is SW2 on the PCB, and here is SW2 documented in the Getting Started guide: https://watchy.sqfmi.com/docs/getting-started/

image

return;
}
}
Expand All @@ -126,6 +127,7 @@ void Watchy::handleButtonPress() {
}
showMenu(menuIndex, true);
} else if (guiState == WATCHFACE_STATE) {
button2();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
button2();
handleButton3Press();

Same deal, with this one being SW3:

image

return;
}
}
Expand All @@ -138,6 +140,7 @@ void Watchy::handleButtonPress() {
}
showMenu(menuIndex, true);
} else if (guiState == WATCHFACE_STATE) {
button3();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
button3();
handleButton4Press();

And this one 🙂

image

return;
}
}
Expand Down Expand Up @@ -579,6 +582,17 @@ void Watchy::drawWatchFace() {
display.println(currentTime.Minute);
}

void Watchy::button1()
{
}
void Watchy::button2()
{
}
void Watchy::button3()
{
}


Comment on lines +585 to +595

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will help keep the style consistent:

Suggested change
void Watchy::button1()
{
}
void Watchy::button2()
{
}
void Watchy::button3()
{
}
void Watchy::handleButton2Press() {}
void Watchy::handleButton3Press() {}
void Watchy::handleButton4Press() {}

weatherData Watchy::getWeatherData() {
return getWeatherData(settings.cityID, settings.weatherUnit,
settings.weatherLang, settings.weatherURL,
Expand Down
3 changes: 3 additions & 0 deletions src/Watchy.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class Watchy {
void showWatchFace(bool partialRefresh);
virtual void drawWatchFace(); // override this method for different watch
// faces
virtual void button1(); // override these methods to handle different non-menu button presses
virtual void button2();
virtual void button3();
Comment on lines +76 to +78

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
virtual void button1(); // override these methods to handle different non-menu button presses
virtual void button2();
virtual void button3();
virtual void handleButton2Press(); // override these methods to handle different non-menu button presses
virtual void handleButton3Press();
virtual void handleButton4Press();


private:
void _bmaConfig();
Expand Down