Make BTClock v8 board working again
This commit is contained in:
parent
41bf2480ce
commit
ff0d8f5a0a
9 changed files with 91 additions and 38 deletions
|
@ -4,6 +4,18 @@ TaskHandle_t buttonTaskHandle = NULL;
|
|||
const TickType_t debounceDelay = pdMS_TO_TICKS(50);
|
||||
TickType_t lastDebounceTime = 0;
|
||||
|
||||
#ifdef IS_BTCLOCK_V8
|
||||
#define BTN_1 0
|
||||
#define BTN_2 1
|
||||
#define BTN_3 2
|
||||
#define BTN_4 3
|
||||
#else
|
||||
#define BTN_1 3
|
||||
#define BTN_2 2
|
||||
#define BTN_3 1
|
||||
#define BTN_4 0
|
||||
#endif
|
||||
|
||||
void buttonTask(void *parameter) {
|
||||
while (1) {
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
|
@ -17,16 +29,16 @@ void buttonTask(void *parameter) {
|
|||
uint pin = mcp1.getLastInterruptPin();
|
||||
|
||||
switch (pin) {
|
||||
case 3:
|
||||
case BTN_1:
|
||||
toggleTimerActive();
|
||||
break;
|
||||
case 2:
|
||||
case BTN_2:
|
||||
nextScreen();
|
||||
break;
|
||||
case 1:
|
||||
case BTN_3:
|
||||
previousScreen();
|
||||
break;
|
||||
case 0:
|
||||
case BTN_4:
|
||||
showSystemStatusScreen();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Preferences preferences;
|
||||
Adafruit_MCP23X17 mcp1;
|
||||
#ifdef IS_BTCLOCK_S3
|
||||
#ifdef IS_BTCLOCK_V8
|
||||
Adafruit_MCP23X17 mcp2;
|
||||
#endif
|
||||
|
||||
|
@ -439,12 +439,12 @@ std::vector<ScreenMapping> getScreenNameMap() { return screenMappings; }
|
|||
|
||||
void setupMcp()
|
||||
{
|
||||
#ifdef IS_BTCLOCK_S3
|
||||
#ifdef IS_BTCLOCK_V8
|
||||
const int mcp1AddrPins[] = {MCP1_A0_PIN, MCP1_A1_PIN, MCP1_A2_PIN};
|
||||
const int mcp1AddrValues[] = {LOW, LOW, LOW};
|
||||
|
||||
const int mcp2AddrPins[] = {MCP2_A0_PIN, MCP2_A1_PIN, MCP2_A2_PIN};
|
||||
const int mcp2AddrValues[] = {LOW, LOW, HIGH};
|
||||
const int mcp2AddrValues[] = {HIGH, LOW, LOW};
|
||||
|
||||
pinMode(MCP_RESET_PIN, OUTPUT);
|
||||
digitalWrite(MCP_RESET_PIN, HIGH);
|
||||
|
@ -505,7 +505,7 @@ void setupHardware()
|
|||
|
||||
if (!mcp1.begin_I2C(0x20))
|
||||
{
|
||||
Serial.println(F("Error MCP23017"));
|
||||
Serial.println(F("Error MCP23017 1"));
|
||||
|
||||
// while (1)
|
||||
// ;
|
||||
|
@ -520,7 +520,7 @@ void setupHardware()
|
|||
mcp1.pinMode(i, INPUT_PULLUP);
|
||||
mcp1.setupInterruptPin(i, LOW);
|
||||
}
|
||||
#ifndef IS_BTCLOCK_S3
|
||||
#ifndef IS_BTCLOCK_V8
|
||||
for (int i = 8; i <= 14; i++)
|
||||
{
|
||||
mcp1.pinMode(i, OUTPUT);
|
||||
|
@ -533,10 +533,10 @@ void setupHardware()
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef IS_BTCLOCK_S3
|
||||
#ifdef IS_BTCLOCK_V8
|
||||
if (!mcp2.begin_I2C(0x21))
|
||||
{
|
||||
Serial.println(F("Error MCP23017"));
|
||||
Serial.println(F("Error MCP23017 2"));
|
||||
|
||||
// while (1)
|
||||
// ;
|
||||
|
|
|
@ -30,7 +30,7 @@ MCP23X17_Pin EPD_RESET_MPD[NUM_SCREENS] = {
|
|||
};
|
||||
|
||||
Native_Pin EPD_DC = Native_Pin(14);
|
||||
#elif IS_BTCLOCK_S3
|
||||
#elif IS_BTCLOCK_V8
|
||||
Native_Pin EPD_DC = Native_Pin(38);
|
||||
|
||||
MCP23X17_Pin EPD_BUSY[NUM_SCREENS] = {
|
||||
|
@ -104,8 +104,8 @@ GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> displays[NUM_SCREENS] = {
|
|||
EPD_CLASS(&EPD_CS[4], &EPD_DC, &EPD_RESET_MPD[4], &EPD_BUSY[4]),
|
||||
EPD_CLASS(&EPD_CS[5], &EPD_DC, &EPD_RESET_MPD[5], &EPD_BUSY[5]),
|
||||
EPD_CLASS(&EPD_CS[6], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[6]),
|
||||
#ifdef IS_BTCLOCK_S3
|
||||
EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[6], &EPD_BUSY[7]),
|
||||
#ifdef IS_BTCLOCK_V8
|
||||
EPD_CLASS(&EPD_CS[7], &EPD_DC, &EPD_RESET_MPD[7], &EPD_BUSY[7]),
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -170,7 +170,7 @@ void setupDisplays()
|
|||
|
||||
updateQueue = xQueueCreate(UPDATE_QUEUE_SIZE, sizeof(UpdateDisplayTaskItem));
|
||||
|
||||
xTaskCreate(prepareDisplayUpdateTask, "PrepareUpd", 2048, NULL, 11, NULL);
|
||||
xTaskCreate(prepareDisplayUpdateTask, "PrepareUpd", 4096, NULL, 11, NULL);
|
||||
|
||||
for (uint i = 0; i < NUM_SCREENS; i++)
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ void setupDisplays()
|
|||
int *taskParam = new int;
|
||||
*taskParam = i;
|
||||
|
||||
xTaskCreate(updateDisplay, ("EpdUpd" + String(i)).c_str(), 2048, taskParam,
|
||||
xTaskCreate(updateDisplay, ("EpdUpd" + String(i)).c_str(), 4096, taskParam,
|
||||
11, &tasks[i]); // create task
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,11 @@ void setupDisplays()
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
#ifdef IS_BTCLOCK_V8
|
||||
epdContent = {"B", "T", "C", "L", "O", "C", "K", "v8"};
|
||||
#else
|
||||
epdContent = {"B", "T", "C", "L", "O", "C", "K"};
|
||||
#endif
|
||||
}
|
||||
|
||||
setEpdContent(epdContent);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "defaults.hpp"
|
||||
|
||||
extern Adafruit_MCP23X17 mcp1;
|
||||
#ifdef IS_BTCLOCK_S3
|
||||
#ifdef IS_BTCLOCK_V8
|
||||
extern Adafruit_MCP23X17 mcp2;
|
||||
#endif
|
||||
extern Preferences preferences;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue