This commit is contained in:
2021-03-09 20:01:22 +01:00
parent 11eac7a8e4
commit ed54e61fef
3 changed files with 5 additions and 6 deletions

View File

@ -36,14 +36,12 @@ void deviceInit() {
void app_main(void)
{
deviceInit();
counterInit();
gpioInit();
networkInit(isGpioForceProv());
counterInit();
/* Start main application now */
while (1) {
ESP_LOGI(TAG, "Hello World!");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}

View File

@ -32,15 +32,15 @@ static void counterZeroCrossingAveragerTask(void *arg) {
if (counterCurrentValue == QUEUE_MARKER) {
if (counterCnt > 0) {
uint32_t counterSecondAverage = ((uint32_t)(counterSum)) / ((uint32_t)(counterCnt));
ESP_LOGI(TAG, "second average is %u", counterSecondAverage);
ESP_LOGI(TAG, "%u %u %u", (uint32_t)counterCnt, (uint32_t)counterSum, counterSecondAverage);
} else {
ESP_LOGW(TAG, "counterCnt is zero");
}
counterCnt = 0;
counterSum = 0;
} else {
counterSum += 1;
counterCnt += counterCurrentValue;
counterCnt += 1;
counterSum += counterCurrentValue;
}
}
}

View File

@ -25,6 +25,7 @@ void gpioInit() {
io_conf.pull_down_en = 0;
gpio_config(&io_conf);
gpio_install_isr_service(0);
gpio_isr_handler_add(GPIO_ZERO_CROSSING, counterZeroCrossingISR, NULL);
ESP_LOGI(TAG, "gpios configured");