Now it looks like you can just allocate from a regular "malloc" Code ran successfully (afaict) when writing to 7MB - didn't seem to when doing 8MB. Not 100% sure why, but I don't think it'll matter tbh
44 lines
879 B
C
44 lines
879 B
C
/**
|
|
* Author: Arthur Roberts (c) 2023
|
|
*
|
|
* License: GPLv3+
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "dht22.h"
|
|
#include "esp_log.h"
|
|
#include "esp_wifi.h"
|
|
|
|
static const char *TAG = "YASPAM";
|
|
|
|
struct air_monitor_data {
|
|
#ifdef CONFIG_DHT22_DATA_GPIO
|
|
deci_percent dht22_relative_humidity;
|
|
deci_degrees_c dht22_temperature;
|
|
#endif /* CONFIG_DHT22_DATA_GPIO */
|
|
|
|
#ifdef CONFIG_PMS5003_DATA_GPIO
|
|
// TODO
|
|
#endif /* CONFIG_PMS5003_DATA_GPIO */
|
|
int64_t time; // TODO think about how best to store this.
|
|
};
|
|
|
|
void app_main(void)
|
|
{
|
|
#ifdef CONFIG_DHT22_DATA_GPIO
|
|
int ret = dht22_read();
|
|
#endif /* CONFIG_DHT22_DATA_GPIO */
|
|
|
|
|
|
|
|
for (int i = 10; i >= 0; i--) {
|
|
printf("Restarting in %d seconds...\n", i);
|
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
}
|
|
printf("Restarting now.\n");
|
|
fflush(stdout);
|
|
esp_restart();
|
|
}
|