delay function sanitized

This commit is contained in:
Klaus K Wilting 2018-12-19 12:32:25 +01:00
parent ea9f462675
commit 48cbcd40cd
8 changed files with 13 additions and 13 deletions

View File

@ -30,7 +30,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
[common] [common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c" ; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 1.6.991 release_version = 1.6.995
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; 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 ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 0 debug_level = 0

View File

@ -173,7 +173,7 @@ uint32_t config_load(uint8_t *config_buffer, uint32_t n_buffer) {
return sizeof(bsec_config_iaq); return sizeof(bsec_config_iaq);
} }
void user_delay_ms(uint32_t period) { vTaskDelay(period / portTICK_PERIOD_MS); } void user_delay_ms(uint32_t period) { delay(period); }
int64_t get_timestamp_us() { return (int64_t)millis() * 1000; } int64_t get_timestamp_us() { return (int64_t)millis() * 1000; }

View File

@ -43,14 +43,14 @@ void init_display(const char *Productname, const char *Version) {
u8x8.draw2x2String(0, 0, Productname); u8x8.draw2x2String(0, 0, Productname);
u8x8.setInverseFont(0); u8x8.setInverseFont(0);
u8x8.draw2x2String(2, 2, Productname); u8x8.draw2x2String(2, 2, Productname);
vTaskDelay(1500 / portTICK_PERIOD_MS); delay(1500);
u8x8.clear(); u8x8.clear();
u8x8.setFlipMode(1); u8x8.setFlipMode(1);
u8x8.setInverseFont(1); u8x8.setInverseFont(1);
u8x8.draw2x2String(0, 0, Productname); u8x8.draw2x2String(0, 0, Productname);
u8x8.setInverseFont(0); u8x8.setInverseFont(0);
u8x8.draw2x2String(2, 2, Productname); u8x8.draw2x2String(2, 2, Productname);
vTaskDelay(1500 / portTICK_PERIOD_MS); delay(1500);
u8x8.setFlipMode(0); u8x8.setFlipMode(0);
u8x8.clear(); u8x8.clear();
@ -81,7 +81,7 @@ void init_display(const char *Productname, const char *Version) {
DisplayKey(buf, 8, true); DisplayKey(buf, 8, true);
#endif // HAS_LORA #endif // HAS_LORA
vTaskDelay(3000 / portTICK_PERIOD_MS); delay(3000);
u8x8.clear(); u8x8.clear();
u8x8.setPowerSave(!cfg.screenon); // set display off if disabled u8x8.setPowerSave(!cfg.screenon); // set display off if disabled
u8x8.draw2x2String(0, 0, "PAX:0"); u8x8.draw2x2String(0, 0, "PAX:0");

View File

@ -70,12 +70,12 @@ void gps_loop(void *pvParameters) {
Wire.requestFrom(GPS_ADDR, 32); // caution: this is a blocking call Wire.requestFrom(GPS_ADDR, 32); // caution: this is a blocking call
while (Wire.available()) { while (Wire.available()) {
gps.encode(Wire.read()); gps.encode(Wire.read());
vTaskDelay(2 / portTICK_PERIOD_MS); // 2ms delay according L76 datasheet delay(2); // 2ms delay according L76 datasheet
} }
#endif #endif
} // if } // if
vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU delay(2); // yield to CPU
} // end of infinite loop } // end of infinite loop

View File

@ -190,7 +190,7 @@ void ledLoop(void *parameter) {
previousLEDState = LEDState; previousLEDState = LEDState;
} }
// give yield to CPU // give yield to CPU
vTaskDelay(2 / portTICK_PERIOD_MS); delay(2);
} // while(1) } // while(1)
vTaskDelete(ledLoopTask); // shoud never be reached vTaskDelete(ledLoopTask); // shoud never be reached
}; // ledloop() }; // ledloop()

View File

@ -358,7 +358,7 @@ void loop() {
#ifdef HAS_LORA #ifdef HAS_LORA
os_runloop_once(); // execute lmic scheduled jobs and events os_runloop_once(); // execute lmic scheduled jobs and events
#endif #endif
vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU delay(2); // yield to CPU
} }
vTaskDelete(NULL); // shoud never be reached vTaskDelete(NULL); // shoud never be reached

View File

@ -77,7 +77,7 @@ void start_ota_update() {
while (i--) { while (i--) {
ESP_LOGI(TAG, "Trying to connect to %s, attempt %u of %u", WIFI_SSID, ESP_LOGI(TAG, "Trying to connect to %s, attempt %u of %u", WIFI_SSID,
WIFI_MAX_TRY - i, WIFI_MAX_TRY); WIFI_MAX_TRY - i, WIFI_MAX_TRY);
vTaskDelay(10000 / portTICK_PERIOD_MS); // wait for stable connect delay(10000); // wait for stable connect
if (WiFi.status() == WL_CONNECTED) { if (WiFi.status() == WL_CONNECTED) {
// we now have wifi connection and try to do an OTA over wifi update // we now have wifi connection and try to do an OTA over wifi update
ESP_LOGI(TAG, "Connected to %s", WIFI_SSID); ESP_LOGI(TAG, "Connected to %s", WIFI_SSID);
@ -98,13 +98,13 @@ void start_ota_update() {
// wifi did not connect // wifi did not connect
ESP_LOGI(TAG, "Could not connect to %s", WIFI_SSID); ESP_LOGI(TAG, "Could not connect to %s", WIFI_SSID);
display(1, " E", "no WiFi connect"); display(1, " E", "no WiFi connect");
vTaskDelay(5000 / portTICK_PERIOD_MS); delay(5000);
end: end:
switch_LED(LED_OFF); switch_LED(LED_OFF);
ESP_LOGI(TAG, "Rebooting to %s firmware", (ret == 0) ? "new" : "current"); ESP_LOGI(TAG, "Rebooting to %s firmware", (ret == 0) ? "new" : "current");
display(5, "**", ""); // mark line rebooting display(5, "**", ""); // mark line rebooting
vTaskDelay(5000 / portTICK_PERIOD_MS); delay(5000);
ESP.restart(); ESP.restart();
} // start_ota_update } // start_ota_update

View File

@ -9,7 +9,7 @@ static const char TAG[] = "main";
void do_reset() { void do_reset() {
ESP_LOGI(TAG, "Remote command: restart device"); ESP_LOGI(TAG, "Remote command: restart device");
LMIC_shutdown(); LMIC_shutdown();
vTaskDelay(3000 / portTICK_PERIOD_MS); delay(3000);
esp_restart(); esp_restart();
} }