Skip to content

Commit

Permalink
Merge pull request #887 from cyberman54/development
Browse files Browse the repository at this point in the history
v3.3.1
  • Loading branch information
cyberman54 authored Aug 18, 2022
2 parents 5327f17 + 9791333 commit d4974d9
Show file tree
Hide file tree
Showing 32 changed files with 169 additions and 409 deletions.
25 changes: 11 additions & 14 deletions include/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <OneBitDisplay.h>
extern ONE_BIT_DISPLAY *dp;
#elif (HAS_DISPLAY) == 2
#include <TFT_eSPI.h>
extern TFT_eSPI *dp;
#include <bb_spi_lcd.h>
extern BB_SPI_LCD *dp;
#endif

#define DISPLAY_PAGES (7) // number of paxcounter display pages
Expand All @@ -24,7 +24,6 @@ extern TFT_eSPI *dp;
#define MY_FONT_NORMAL FONT_8x8
#define MY_FONT_LARGE FONT_16x32
#define MY_FONT_STRETCHED FONT_12x16

#define MY_DISPLAY_FIRSTLINE 30

#ifndef MY_DISPLAY_RST
Expand All @@ -51,22 +50,21 @@ extern TFT_eSPI *dp;
// settings for TFT display library
#elif (HAS_DISPLAY == 2)

#define MY_FONT_SMALL 1
#define MY_FONT_SMALL 2
#define MY_FONT_NORMAL 2
#define MY_FONT_LARGE 4
#define MY_FONT_STRETCHED 6

#define MY_FONT_LARGE 2
#define MY_FONT_STRETCHED 2
#define MY_DISPLAY_FIRSTLINE 30

#ifndef TFT_FREQUENCY
#define TFT_FREQUENCY 400000L
#endif

#ifndef MY_DISPLAY_FGCOLOR
#define MY_DISPLAY_FGCOLOR 0xFFFF // TFT_WHITE
#define MY_DISPLAY_FGCOLOR TFT_YELLOW
#endif
#ifndef MY_DISPLAY_BGCOLOR
#define MY_DISPLAY_BGCOLOR 0x0000 // TFT_BLACK
#endif

#ifndef TOUCH_CS
#define TOUCH_CS NOT_A_PIN
#define MY_DISPLAY_BGCOLOR TFT_BLACK
#endif

#endif
Expand Down Expand Up @@ -104,7 +102,6 @@ void dp_setup(int contrast = 0);
void dp_refresh(bool nextPage = false);
void dp_init(bool verbose = false);
void dp_shutdown(void);
void dp_message(const char *msg, int line, bool invers);
void dp_setFont(int font, int inv = 0);
void dp_dump(uint8_t *pBuffer = NULL);
void dp_contrast(uint8_t contrast);
Expand Down
2 changes: 1 addition & 1 deletion include/payload.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#endif

class PayloadConvert {

public:
PayloadConvert(uint8_t size);
~PayloadConvert();
Expand All @@ -59,6 +58,7 @@ class PayloadConvert {
void addSensor(uint8_t[]);
void addTime(time_t value);
void addSDS(sdsStatus_t value);

private:
void addChars( char* string, int len);

Expand Down
8 changes: 4 additions & 4 deletions include/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

#ifndef PMU_CHG_CUTOFF
#ifdef HAS_PMU
#define PMU_CHG_CUTOFF AXP202_TARGET_VOL_4_2V
#define PMU_CHG_CUTOFF XPOWERS_CHG_VOL_4V2
#elif defined HAS_IP5306
#define PMU_CHG_CUTOFF 0
#endif
#endif

#ifndef PMU_CHG_CURRENT
#ifdef HAS_PMU
#define PMU_CHG_CURRENT AXP1XX_CHARGE_CUR_450MA
#define PMU_CHG_CURRENT XPOWERS_CHG_CUR_450MA
#elif defined HAS_IP5306
#define PMU_CHG_CURRENT 2
#endif
Expand All @@ -55,8 +55,8 @@ void calibrate_voltage(void);
bool batt_sufficient(void);

#ifdef HAS_PMU
#include <axp20x.h>
extern AXP20X_Class pmu;
#include <XPowersLib.h>
extern XPowersPMU pmu;
enum pmu_power_t { pmu_power_on, pmu_power_off, pmu_power_sleep };
void AXP192_powerevent_IRQ(void);
void AXP192_power(pmu_power_t powerlevel);
Expand Down
1 change: 0 additions & 1 deletion lib/BintrayClient/src/BintrayClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <WString.h>

class BintrayClient {

public:
BintrayClient(const String& user, const String& repository, const String& package);
String getUser() const;
Expand Down
11 changes: 5 additions & 6 deletions platformio_orig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,24 @@ description = Paxcounter is a device for metering passenger flows in realtime. I

[common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 3.3.0
release_version = 3.3.1
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 3
extra_scripts = pre:build.py
otakeyfile = ota.conf
lorakeyfile = loraconf.h
lmicconfigfile = lmic_config.h
platform_espressif32 = espressif32@5.0.0
platform_espressif32 = espressif32@5.1.0
monitor_speed = 115200
upload_speed = 115200 ; set by build.py and taken from hal file
display_library = ; set by build.py and taken from hal file
lib_deps_lora =
mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1
lib_deps_display =
https://github.com/bitbank2/OneBitDisplay#8d4ab34
;bitbank2/OneBitDisplay @ ^2.1.0
https://github.com/bitbank2/OneBitDisplay.git
https://github.com/bitbank2/bb_spi_lcd.git
ricmoo/QRCode @ ^0.0.1
bodmer/TFT_eSPI @ ^2.3.84
lib_deps_ledmatrix =
seeed-studio/Ultrathin_LED_Matrix @ ^1.0.0
lib_deps_rgbled =
Expand All @@ -83,7 +82,7 @@ lib_deps_basic =
bblanchon/ArduinoJson @ ^6
makuna/RTC @ ^2.3.5
spacehuhn/SimpleButton
lewisxhe/AXP202X_Library @ ^1.1.3
https://github.com/lewisxhe/XPowersLib.git
256dpi/MQTT @ ^2.4.8
lib_deps_all =
${common.lib_deps_basic}
Expand Down
5 changes: 0 additions & 5 deletions src/bmesensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void setBMEIRQ() { xTaskNotify(irqHandlerTask, BME_IRQ, eSetBits); }
// initialize MEMS sensor
// return = 0 -> error / return = 1 -> success
int bme_init(void) {

int rc = 0;

#ifdef HAS_BME680
Expand Down Expand Up @@ -77,7 +76,6 @@ int bme_init(void) {
if (rc)
bmecycler.attach(BMECYCLE, setBMEIRQ); // start cyclic data transmit
return rc;

} // bme_init()

#ifdef HAS_BME680
Expand Down Expand Up @@ -108,7 +106,6 @@ int checkIaqSensorStatus(void) {

// store current BME sensor data in struct
void bme_storedata(bmeStatus_t *bme_store) {

if (cfg.payloadmask & MEMS_DATA)

#ifdef HAS_BME680
Expand Down Expand Up @@ -138,7 +135,6 @@ void bme_storedata(bmeStatus_t *bme_store) {
// bme.readAltitude(SEALEVELPRESSURE_HPA);
bme_store->iaq = 0; // IAQ feature not present with BME280
#endif

} // bme_storedata()

#ifdef HAS_BME680
Expand All @@ -165,7 +161,6 @@ void updateState(void) {
stateUpdateCounter++;
}
} else {

/* Update every STATE_SAVE_PERIOD minutes */
if ((long)(millis() - stateUpdateCounter * STATE_SAVE_PERIOD) >= 0) {
update = true;
Expand Down
4 changes: 0 additions & 4 deletions src/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ void IRAM_ATTR watchdog() { xTaskResumeFromISR(RestartHandle); }
// used for manually uploading a firmware file via wifi

void start_boot_menu(void) {

const char *host = clientId;
const char *ssid = WIFI_SSID;
const char *password = WIFI_PASS;
Expand Down Expand Up @@ -150,9 +149,7 @@ void start_boot_menu(void) {

// did we get a file name?
if (upload.filename != NULL) {

switch (upload.status) {

case UPLOAD_FILE_START:
// start file transfer
ESP_LOGI(TAG, "Uploading %s", upload.filename.c_str());
Expand All @@ -177,7 +174,6 @@ void start_boot_menu(void) {
case UPLOAD_FILE_ABORTED:
default:
break;

} // switch

// don't boot to production if update failed
Expand Down
3 changes: 0 additions & 3 deletions src/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ static uint8_t buffer[cfgLen + cfgLen2];
// 3. magicByte [cfgLen2 bytes, containing a fixed identifier]

static void defaultConfig(configData_t *myconfig) {

strncpy(myconfig->version, PROGVERSION,
sizeof(myconfig->version) - 1); // Firmware version

Expand Down Expand Up @@ -92,7 +91,6 @@ void saveConfig(bool erase) {

// load configuration from NVRAM into RAM and make it current
void loadConfig(void) {

int readBytes = 0;

ESP_LOGI(TAG, "Loading device configuration from NVRAM...");
Expand Down Expand Up @@ -144,7 +142,6 @@ bool comp(char s1, char s2) { return (tolower(s1) < tolower(s2)); }
// helper function to lexicographically compare two versions. Returns 1 if v2
// is smaller, -1 if v1 is smaller, 0 if equal
int version_compare(const String v1, const String v2) {

if (v1 == v2)
return 0;

Expand Down
2 changes: 0 additions & 2 deletions src/cyclic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ void setCyclicIRQ() { xTaskNotify(irqHandlerTask, CYCLIC_IRQ, eSetBits); }

// do all housekeeping
void doHousekeeping() {

// check if update or maintenance mode trigger switch was set by rcommand
if ((RTC_runmode == RUNMODE_UPDATE) || (RTC_runmode == RUNMODE_MAINTENANCE))
do_reset(true); // warmstart
Expand Down Expand Up @@ -125,7 +124,6 @@ void doHousekeeping() {
#if (HAS_SDCARD)
sdcard_flush();
#endif

} // doHousekeeping()

uint32_t getFreeRAM() {
Expand Down
10 changes: 0 additions & 10 deletions src/dcf77.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,33 @@ static const char TAG[] = __FILE__;

// triggered by second timepulse to ticker out DCF signal
void DCF77_Pulse(uint8_t bit) {

TickType_t startTime;

// induce a DCF Pulse
for (uint8_t pulseLength = 0; pulseLength <= 2; pulseLength++) {

startTime = xTaskGetTickCount(); // reference time pulse start

switch (pulseLength) {

case 0: // 0ms = start of pulse
digitalWrite(HAS_DCF77, dcf_low);
break;

case 1: // 100ms = logic 0
if (bit == 0)
digitalWrite(HAS_DCF77, dcf_high);
break;

case 2: // 200ms = logic 1
digitalWrite(HAS_DCF77, dcf_high);
break;

} // switch

// delay to genrate pulseLength
vTaskDelayUntil(&startTime, pdMS_TO_TICKS(100));

} // for
} // DCF77_Pulse()

// helper function to convert decimal to bcd digit
uint64_t dec2bcd(uint8_t const dec, uint8_t const startpos,
uint8_t const endpos, uint8_t *parity) {

uint8_t data = dec < 10 ? dec : ((dec / 10) << 4) + dec % 10;
uint64_t bcd = 0;

Expand All @@ -68,7 +60,6 @@ uint64_t dec2bcd(uint8_t const dec, uint8_t const startpos,

// generates a 1 minute dcf pulse frame for calendar time t
uint64_t DCF77_Frame(const struct tm t) {

uint8_t parity = 0, parity_sum = 0;
uint64_t frame = 0; // start with all bits 0

Expand Down Expand Up @@ -105,7 +96,6 @@ uint64_t DCF77_Frame(const struct tm t) {
frame += parity_sum ? set_dcfbit(58) : 0;

return frame;

} // DCF77_Frame()

#endif // HAS_DCF77
Loading

0 comments on commit d4974d9

Please sign in to comment.