code sanitizations
This commit is contained in:
parent
c9303e916d
commit
5327f17237
@ -87,7 +87,6 @@ byte CFG_CFG[] = {
|
||||
// helper functions to send UBX commands to ublox gps chip
|
||||
|
||||
void sendPacket(byte *packet, byte len) {
|
||||
|
||||
uint8_t CK_A = 0;
|
||||
uint8_t CK_B = 0;
|
||||
|
||||
@ -107,7 +106,6 @@ void restoreDefaults() { sendPacket(CFG_CFG, sizeof(CFG_CFG)); }
|
||||
void changeBaudrate() { sendPacket(CFG_PRT, sizeof(CFG_PRT)); }
|
||||
|
||||
void disableNmea() {
|
||||
|
||||
// tinygps++ processes only $GPGGA/$GNGGA and $GPRMC/$GNRMC
|
||||
// thus, we disable all other NMEA messages
|
||||
|
||||
@ -128,7 +126,6 @@ void disableNmea() {
|
||||
|
||||
// initialize and configure GPS
|
||||
int gps_init(void) {
|
||||
|
||||
ESP_LOGI(TAG, "Opening serial GPS");
|
||||
|
||||
GPS_Serial.begin(GPS_SERIAL);
|
||||
@ -144,7 +141,6 @@ int gps_init(void) {
|
||||
disableNmea();
|
||||
|
||||
return 1;
|
||||
|
||||
} // gps_init()
|
||||
|
||||
// store current GPS location data in struct
|
||||
@ -170,13 +166,11 @@ bool gps_hasfix() {
|
||||
|
||||
// function to poll UTC time from GPS NMEA data; note: this is costly
|
||||
time_t get_gpstime(uint16_t *msec = 0) {
|
||||
|
||||
const uint16_t txDelay =
|
||||
70U * 1000 / (GPS_BAUDRATE / 9); // serial tx of 70 NMEA chars
|
||||
|
||||
// did we get a current date & time?
|
||||
if (gps.time.age() < 1000) {
|
||||
|
||||
// convert tinygps time format to struct tm format
|
||||
struct tm gps_tm = {0};
|
||||
gps_tm.tm_sec = gps.time.second();
|
||||
@ -209,18 +203,15 @@ time_t get_gpstime(uint16_t *msec = 0) {
|
||||
|
||||
ESP_LOGD(TAG, "no valid GPS time");
|
||||
return 0;
|
||||
|
||||
} // get_gpstime()
|
||||
|
||||
// GPS serial feed FreeRTos Task
|
||||
void gps_loop(void *pvParameters) {
|
||||
|
||||
_ASSERT((uint32_t)pvParameters == 1); // FreeRTOS check
|
||||
|
||||
// feed GPS decoder with serial NMEA data from GPS device
|
||||
while (1) {
|
||||
while (cfg.payloadmask & GPS_DATA) {
|
||||
|
||||
while (GPS_Serial.available())
|
||||
gps.encode(GPS_Serial.read());
|
||||
|
||||
@ -228,7 +219,6 @@ void gps_loop(void *pvParameters) {
|
||||
}
|
||||
delay(1000);
|
||||
} // infinite while loop
|
||||
|
||||
} // gps_loop()
|
||||
|
||||
#endif // HAS_GPS
|
||||
|
@ -70,7 +70,6 @@ void refreshTheMatrixDisplay(bool nextPage) {
|
||||
}
|
||||
|
||||
switch (DisplayPage % MATRIX_DISPLAY_PAGES) {
|
||||
|
||||
// page 0: number of current pax OR footfall line diagram
|
||||
// page 1: time of day
|
||||
|
||||
@ -89,18 +88,14 @@ void refreshTheMatrixDisplay(bool nextPage) {
|
||||
}
|
||||
|
||||
else { // cyclic counter mode -> plot a line diagram
|
||||
|
||||
if (ulLastNumMacs != count.pax) {
|
||||
|
||||
// next count cycle?
|
||||
if (count.pax == 0) {
|
||||
|
||||
// matrix full? then scroll left 1 dot, else increment column
|
||||
if (col < (LED_MATRIX_WIDTH - 1))
|
||||
col++;
|
||||
else
|
||||
ScrollMatrixLeft(displaybuf, LED_MATRIX_WIDTH, LED_MATRIX_HEIGHT);
|
||||
|
||||
} else
|
||||
matrix.drawPoint(col, row, 0); // clear current dot
|
||||
|
||||
@ -124,7 +119,6 @@ void refreshTheMatrixDisplay(bool nextPage) {
|
||||
// DrawNumber(myTZ.dateTime("H:i:s").c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
} // switch page
|
||||
|
||||
matrix.scan();
|
||||
|
@ -41,7 +41,6 @@ inline String getHeaderValue(String header, String headerName) {
|
||||
}
|
||||
|
||||
void start_ota_update() {
|
||||
|
||||
const char *host = clientId;
|
||||
|
||||
switch_LED(LED_ON);
|
||||
@ -121,13 +120,11 @@ end:
|
||||
ota_display(5, "**", ""); // mark line rebooting
|
||||
delay(5000);
|
||||
do_reset(false);
|
||||
|
||||
} // start_ota_update
|
||||
|
||||
// Reads data vom wifi client and flashes it to ota partition
|
||||
// returns: 0 = finished, 1 = retry, -1 = abort
|
||||
int do_ota_update() {
|
||||
|
||||
char buf[17];
|
||||
bool redirect = true;
|
||||
size_t written = 0;
|
||||
@ -319,7 +316,6 @@ abort:
|
||||
|
||||
retry:
|
||||
return 1;
|
||||
|
||||
} // do_ota_update
|
||||
|
||||
void ota_display(const uint8_t row, const std::string status,
|
||||
|
@ -26,7 +26,6 @@ static const adc_unit_t unit = ADC_UNIT_1;
|
||||
AXP20X_Class pmu;
|
||||
|
||||
void AXP192_powerevent_IRQ(void) {
|
||||
|
||||
pmu.readIRQ();
|
||||
|
||||
if (pmu.isVbusOverVoltageIRQ())
|
||||
@ -83,9 +82,7 @@ void AXP192_powerevent_IRQ(void) {
|
||||
}
|
||||
|
||||
void AXP192_power(pmu_power_t powerlevel) {
|
||||
|
||||
switch (powerlevel) {
|
||||
|
||||
case pmu_power_off:
|
||||
pmu.shutdown();
|
||||
break;
|
||||
@ -119,7 +116,6 @@ void AXP192_power(pmu_power_t powerlevel) {
|
||||
}
|
||||
|
||||
void AXP192_showstatus(void) {
|
||||
|
||||
if (pmu.isBatteryConnect())
|
||||
if (pmu.isChargeing())
|
||||
ESP_LOGI(TAG, "Battery charging, %.2fV @ %.0fmAh",
|
||||
@ -137,12 +133,10 @@ void AXP192_showstatus(void) {
|
||||
}
|
||||
|
||||
void AXP192_init(void) {
|
||||
|
||||
if (pmu.begin(i2c_readBytes, i2c_writeBytes, AXP192_PRIMARY_ADDRESS) ==
|
||||
AXP_FAIL)
|
||||
ESP_LOGI(TAG, "AXP192 PMU initialization failed");
|
||||
else {
|
||||
|
||||
// configure voltages
|
||||
pmu.setDCDC1Voltage(3300); // for external OLED display
|
||||
pmu.setLDO2Voltage(3300); // LORA VDD 3v3
|
||||
|
Loading…
Reference in New Issue
Block a user