mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-12-16 18:48:26 +01:00
Show BT icon on countdown
This commit is contained in:
@@ -19,10 +19,14 @@ static unsigned char OFFLINE_BITS[] = {
|
||||
0xE6, 0x00, 0xFE, 0x1F, 0xFE, 0x1F, 0xE6, 0x00, 0x62, 0x00,
|
||||
0x30, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
// {
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x62, 0x00, 0xE2, 0x00,
|
||||
// 0xFE, 0x1F, 0xFE, 0x1F, 0xE2, 0x00, 0x62, 0x00, 0x60, 0x00, 0x30, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, };
|
||||
|
||||
static unsigned char BLUETOOTH_BITS[] = {
|
||||
0x00, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x3a, 0x00, 0x60,
|
||||
0x72, 0x00, 0xe0, 0x72, 0x00, 0xc0, 0x3b, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f,
|
||||
0x00, 0x80, 0x1f, 0x00, 0xc0, 0x3b, 0x00, 0xe0, 0x72, 0x00, 0x60, 0x72, 0x00, 0x00, 0x3a, 0x00,
|
||||
0x00, 0x1e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x00
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Show dashboard temperature and humdity
|
||||
*
|
||||
@@ -270,6 +274,28 @@ void OledDisplay::setText(const char *line1, const char *line2,
|
||||
}
|
||||
}
|
||||
|
||||
void OledDisplay::showWiFiProvisioning(bool firstRun, int countdown) {
|
||||
if (firstRun) {
|
||||
DISP()->clearBuffer();
|
||||
DISP()->setFont(u8g2_font_t0_16_tf);
|
||||
DISP()->drawStr(1, 25, "to WiFi hotspot:");
|
||||
DISP()->drawStr(1, 40, "\"airgradient-");
|
||||
DISP()->drawStr(1, 55, (ag->deviceId() + "\"").c_str());
|
||||
DISP()->drawXBM(108, 44, 20, 20, BLUETOOTH_BITS);
|
||||
DISP()->sendBuffer();
|
||||
}
|
||||
|
||||
// Now just update countdown area
|
||||
char buf[16];
|
||||
snprintf(buf, sizeof(buf), "%ds to connect", countdown);
|
||||
DISP()->setDrawColor(0); // erase previous text
|
||||
DISP()->drawBox(0, 0, 128, 16); // clear top region
|
||||
DISP()->setDrawColor(1); // draw new text in white
|
||||
DISP()->setFont(u8g2_font_t0_16_tf);
|
||||
DISP()->drawStr(1, 10, buf);
|
||||
DISP()->sendBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update dashboard content
|
||||
*
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
void setText(String &line1, String &line2, String &line3, String &line4);
|
||||
void setText(const char *line1, const char *line2, const char *line3,
|
||||
const char *line4);
|
||||
void showWiFiProvisioning(bool firstRun, int countdown);
|
||||
void showDashboard(void);
|
||||
void showDashboard(DashboardStatus status);
|
||||
void setBrightness(int percent);
|
||||
|
||||
@@ -494,13 +494,10 @@ void StateMachine::displayHandle(AgStateMachineState state) {
|
||||
if (ag->isBasic()) {
|
||||
String ssid = "\"airgradient-" + ag->deviceId() + "\" " +
|
||||
String(wifiConnectCountDown) + String("s");
|
||||
disp.setText("Connect tohotspot:", ssid.c_str(), "");
|
||||
disp.setText("Connect to hotspot:", ssid.c_str(), "");
|
||||
} else {
|
||||
String line1 = String(wifiConnectCountDown) + "s to connect";
|
||||
String line2 = "to WiFi hotspot:";
|
||||
String line3 = "\"airgradient-";
|
||||
String line4 = ag->deviceId() + "\"";
|
||||
disp.setText(line1, line2, line3, line4);
|
||||
// NOTE: This bool is hardcoded!
|
||||
disp.showWiFiProvisioning((wifiConnectCountDown == 180), wifiConnectCountDown);
|
||||
}
|
||||
wifiConnectCountDown--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user