Skip to main content

Dwi259eti Firmware File

// Save a float threshold to NVS esp_err_t my_feature_save_threshold(float thr)

If the feature is periodic, spawn a FreeRTOS task: Dwi259eti Firmware

static const char *TAG = "my_feature";

nvs_handle_t h; ESP_ERROR_CHECK(nvs_open("my_feat", NVS_READWRITE, &h)); ESP_ERROR_CHECK(nvs_set_blob(h, "threshold", &thr, sizeof(thr))); ESP_ERROR_CHECK(nvs_commit(h)); nvs_close(h); return ESP_OK; // Save a float threshold to NVS esp_err_t

/* Example: read a temperature sensor on I2C address 0x48 */ int my_feature_get_temperature(float *temp_c) Dwi259eti Firmware

at_register_command("AT+TEMP?", at_cmd_temp_handler, AT_CMD_TYPE_QUERY);

float temperature; if (my_feature_get_temperature(&temperature) == 0) at_reply("%0.2f", temperature); else at_reply_error();

// Save a float threshold to NVS esp_err_t my_feature_save_threshold(float thr)

If the feature is periodic, spawn a FreeRTOS task:

static const char *TAG = "my_feature";

nvs_handle_t h; ESP_ERROR_CHECK(nvs_open("my_feat", NVS_READWRITE, &h)); ESP_ERROR_CHECK(nvs_set_blob(h, "threshold", &thr, sizeof(thr))); ESP_ERROR_CHECK(nvs_commit(h)); nvs_close(h); return ESP_OK;

/* Example: read a temperature sensor on I2C address 0x48 */ int my_feature_get_temperature(float *temp_c)

at_register_command("AT+TEMP?", at_cmd_temp_handler, AT_CMD_TYPE_QUERY);

float temperature; if (my_feature_get_temperature(&temperature) == 0) at_reply("%0.2f", temperature); else at_reply_error();