Rename measurementCycle on agVlaue to Measures

capitalize static const for image bit
This commit is contained in:
samuelbles07
2025-03-28 13:45:07 +07:00
parent fff982f35f
commit 67d377a514
4 changed files with 15 additions and 15 deletions

View File

@ -119,7 +119,7 @@ static bool ledBarButtonTest = false;
static String fwNewVersion; static String fwNewVersion;
SemaphoreHandle_t mutexMeasurementCycleQueue; SemaphoreHandle_t mutexMeasurementCycleQueue;
static std::vector<Measurements::MeasurementCycle> measurementCycleQueue; static std::vector<Measurements::Measures> measurementCycleQueue;
static void boardInit(void); static void boardInit(void);
static void initializeNetwork(); static void initializeNetwork();
@ -1327,7 +1327,7 @@ void postUsingCellular() {
for (int i = 0; i < queueSize; i++) { for (int i = 0; i < queueSize; i++) {
auto mc = measurementCycleQueue.at(i); auto mc = measurementCycleQueue.at(i);
payload += ","; payload += ",";
payload += measurements.buildMeasurementPayload(mc); payload += measurements.buildMeasuresPayload(mc);
} }
// Release before actually post measures that might takes too long // Release before actually post measures that might takes too long
@ -1529,7 +1529,7 @@ void newMeasurementCycle() {
measurementCycleQueue.erase(measurementCycleQueue.begin()); measurementCycleQueue.erase(measurementCycleQueue.begin());
} }
Measurements::MeasurementCycle mc = measurements.getMeasurementCycle(); auto mc = measurements.getMeasures();
measurementCycleQueue.push_back(mc); measurementCycleQueue.push_back(mc);
Serial.println("New measurement cycle added to queue"); Serial.println("New measurement cycle added to queue");
// Release mutex // Release mutex

View File

@ -5,16 +5,16 @@
/** Cast U8G2 */ /** Cast U8G2 */
#define DISP() ((U8G2_SH1106_128X64_NONAME_F_HW_I2C *)(this->u8g2)) #define DISP() ((U8G2_SH1106_128X64_NONAME_F_HW_I2C *)(this->u8g2))
static const unsigned char wifi_issue_bits[] = { static const unsigned char WIFI_ISSUE_BITS[] = {
0xd8, 0xc6, 0xde, 0xde, 0xc7, 0xf8, 0xd1, 0xe2, 0xdc, 0xce, 0xcc, 0xd8, 0xc6, 0xde, 0xde, 0xc7, 0xf8, 0xd1, 0xe2, 0xdc, 0xce, 0xcc,
0xcc, 0xc0, 0xc0, 0xd0, 0xc2, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0}; 0xcc, 0xc0, 0xc0, 0xd0, 0xc2, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0};
static const unsigned char cloud_issue_bits[] = { static const unsigned char CLOUD_ISSUE_BITS[] = {
0x70, 0xc0, 0x88, 0xc0, 0x04, 0xc1, 0x04, 0xcf, 0x02, 0xd0, 0x01, 0x70, 0xc0, 0x88, 0xc0, 0x04, 0xc1, 0x04, 0xcf, 0x02, 0xd0, 0x01,
0xe0, 0x01, 0xe0, 0x01, 0xe0, 0xa2, 0xd0, 0x4c, 0xce, 0xa0, 0xc0}; 0xe0, 0x01, 0xe0, 0x01, 0xe0, 0xa2, 0xd0, 0x4c, 0xce, 0xa0, 0xc0};
// Offline mode icon // Offline mode icon
static unsigned char offline_bits[] = { static unsigned char OFFLINE_BITS[] = {
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x62, 0x00,
0xE6, 0x00, 0xFE, 0x1F, 0xFE, 0x1F, 0xE6, 0x00, 0x62, 0x00, 0xE6, 0x00, 0xFE, 0x1F, 0xFE, 0x1F, 0xE6, 0x00, 0x62, 0x00,
0x30, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -304,12 +304,12 @@ void OledDisplay::showDashboard(DashboardStatus status) {
break; break;
} }
case DashBoardStatusWiFiIssue: { case DashBoardStatusWiFiIssue: {
DISP()->drawXBM(icon_pos_x, 0, 14, 11, wifi_issue_bits); DISP()->drawXBM(icon_pos_x, 0, 14, 11, WIFI_ISSUE_BITS);
showTempHum(false); showTempHum(false);
break; break;
} }
case DashBoardStatusServerIssue: { case DashBoardStatusServerIssue: {
DISP()->drawXBM(icon_pos_x, 0, 14, 11, cloud_issue_bits); DISP()->drawXBM(icon_pos_x, 0, 14, 11, CLOUD_ISSUE_BITS);
showTempHum(false); showTempHum(false);
break; break;
} }
@ -322,7 +322,7 @@ void OledDisplay::showDashboard(DashboardStatus status) {
break; break;
} }
case DashBoardStatusOfflineMode: { case DashBoardStatusOfflineMode: {
DISP()->drawXBM(icon_pos_x, 0, 14, 14, offline_bits); DISP()->drawXBM(icon_pos_x, 0, 14, 14, OFFLINE_BITS);
showTempHum(false); // First true showTempHum(false); // First true
break; break;
} }

View File

@ -688,8 +688,8 @@ float Measurements::getCorrectedPM25(bool useAvg, int ch, bool forceCorrection)
return corrected; return corrected;
} }
Measurements::MeasurementCycle Measurements::getMeasurementCycle() { Measurements::Measures Measurements::getMeasures() {
MeasurementCycle mc; Measures mc;
mc.bootCount = _bootCount; mc.bootCount = _bootCount;
mc.freeHeap = ESP.getFreeHeap(); mc.freeHeap = ESP.getFreeHeap();
// co2, tvoc, nox // co2, tvoc, nox
@ -734,7 +734,7 @@ Measurements::MeasurementCycle Measurements::getMeasurementCycle() {
return mc; return mc;
} }
std::string Measurements::buildMeasurementPayload(MeasurementCycle &mc) { std::string Measurements::buildMeasuresPayload(Measures &mc) {
std::ostringstream oss; std::ostringstream oss;
// CO2 // CO2

View File

@ -38,7 +38,7 @@ public:
Measurements(Configuration &config); Measurements(Configuration &config);
~Measurements() {} ~Measurements() {}
struct MeasurementCycle { struct Measures {
float temperature[2]; float temperature[2];
float humidity[2]; float humidity[2];
float co2; float co2;
@ -180,9 +180,9 @@ public:
*/ */
String toString(bool localServer, AgFirmwareMode fwMode, int rssi); String toString(bool localServer, AgFirmwareMode fwMode, int rssi);
MeasurementCycle getMeasurementCycle(); Measures getMeasures();
std::string buildMeasurementPayload(MeasurementCycle &mc); std::string buildMeasuresPayload(Measures &measures);
/** /**
* Set to true if want to debug every update value * Set to true if want to debug every update value