Added timer pause/resume button and updated README
This commit is contained in:
parent
05e459a64c
commit
a1c5d8a579
@ -5,6 +5,15 @@
|
||||
Improved code for BTClock with many features.
|
||||
Don't forget to copy `config.h.example` to `config.h`. Not necessary to adapt it, since everything should be configurable through the WebUI.
|
||||
|
||||
### Button actions
|
||||
|
||||
(Top = 1 to bottom = 4)
|
||||
|
||||
1. Start/stop timer (confirmed with LEDs)
|
||||
2. Next screen
|
||||
3. Previous screen
|
||||
4. Show IP address
|
||||
|
||||
## Software
|
||||
|
||||
- [PlatformIO](https://platformio.org/platformio-ide).
|
||||
|
@ -37,9 +37,9 @@ void setupSoftAP()
|
||||
{
|
||||
byte mac[6];
|
||||
WiFi.macAddress(mac);
|
||||
softAP_SSID = String("BTClock" + String(mac[3], 16) + String(mac[1], 16));
|
||||
softAP_SSID = String("BTClock" + String(mac[5], 16) + String(mac[6], 16));
|
||||
WiFi.setHostname(softAP_SSID.c_str());
|
||||
softAP_password = base64::encode(String(mac[2], 16) + String(mac[4], 16) + String(mac[5], 16) + String(mac[6], 16)).substring(2, 12);
|
||||
softAP_password = base64::encode(String(mac[2], 16) + String(mac[4], 16) + String(mac[5], 16) + String(mac[6], 16)).substring(2, 10);
|
||||
}
|
||||
|
||||
void setupComponents()
|
||||
@ -132,7 +132,7 @@ void setupWifi()
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -237,6 +237,67 @@ void handleScreenTasks(uint screen)
|
||||
}
|
||||
}
|
||||
|
||||
void toggleScreenTimer()
|
||||
{
|
||||
timerRunning = !timerRunning;
|
||||
|
||||
if (!timerRunning)
|
||||
{
|
||||
Serial.println("Stopping screen timer...");
|
||||
for (int i = NEOPIXEL_COUNT; i >= 0; i--)
|
||||
{
|
||||
for (int j = NEOPIXEL_COUNT; j >= 0; j--)
|
||||
{
|
||||
uint32_t c = pixels.Color(0, 0, 0);
|
||||
if (i == j)
|
||||
c = pixels.Color(0, 255, 0);
|
||||
pixels.setPixelColor(j, c);
|
||||
}
|
||||
|
||||
pixels.show();
|
||||
|
||||
delay(100);
|
||||
}
|
||||
|
||||
delay(900);
|
||||
|
||||
pixels.clear();
|
||||
pixels.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("Starting screen timer...");
|
||||
|
||||
pixels.setPixelColor(3, pixels.Color(0, 255, 0));
|
||||
pixels.setPixelColor(2, pixels.Color(0, 0, 0));
|
||||
pixels.setPixelColor(1, pixels.Color(0, 0, 0));
|
||||
pixels.setPixelColor(0, pixels.Color(0, 0, 0));
|
||||
pixels.show();
|
||||
|
||||
delay(1000);
|
||||
|
||||
for (int i = NEOPIXEL_COUNT; i--; i > 0)
|
||||
{
|
||||
|
||||
for (int j = NEOPIXEL_COUNT; j--; j > 0)
|
||||
{
|
||||
uint32_t c = pixels.Color(0, 0, 0);
|
||||
if (i == j)
|
||||
c = pixels.Color(0, 255, 0);
|
||||
|
||||
pixels.setPixelColor(j, c);
|
||||
}
|
||||
|
||||
pixels.show();
|
||||
|
||||
delay(100);
|
||||
}
|
||||
|
||||
pixels.clear();
|
||||
pixels.show();
|
||||
}
|
||||
}
|
||||
|
||||
int getBgColor()
|
||||
{
|
||||
return bgColor;
|
||||
|
@ -25,6 +25,7 @@ uint getCurrentScreen();
|
||||
void setCurrentScreen(uint screen);
|
||||
void handleScreenTasks(uint screen);
|
||||
void showNetworkSettings();
|
||||
void toggleScreenTimer();
|
||||
|
||||
void timebasedChangeTask(void *parameter);
|
||||
|
||||
|
@ -20,15 +20,16 @@ void buttonTask(void *parameter)
|
||||
{
|
||||
uint pin = mcp.getLastInterruptPin();
|
||||
if (pin == 3) {
|
||||
xTaskCreate(fullRefresh, "FullRefresh", 2048, NULL, 1, NULL);
|
||||
// xTaskCreate(fullRefresh, "FullRefresh", 2048, NULL, 1, NULL);
|
||||
toggleScreenTimer();
|
||||
}
|
||||
else if (pin == 1)
|
||||
{
|
||||
nextScreen();
|
||||
previousScreen();
|
||||
}
|
||||
else if (pin == 2)
|
||||
{
|
||||
previousScreen();
|
||||
nextScreen();
|
||||
}
|
||||
else if (pin == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user