mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-12 00:30:17 +00:00
ESP-IDF Robot Controls
This commit is contained in:
0
ESP-IDF_Robot/build/.ninja_lock
Normal file
0
ESP-IDF_Robot/build/.ninja_lock
Normal file
@@ -1 +1 @@
|
|||||||
ad60d895e8210766ffb98e7e17c7b6546f14a278
|
a845724773d9756901c2e6e1aed5250f9b4f6e67
|
||||||
|
@@ -599,6 +599,70 @@ static void espnow_deinit(espnow_send_param_t *send_param)
|
|||||||
esp_now_deinit();
|
esp_now_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
ADC Calibration
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
static bool adc_calibration_init(adc_unit_t unit, adc_channel_t channel, adc_atten_t atten, adc_cali_handle_t *out_handle)
|
||||||
|
{
|
||||||
|
adc_cali_handle_t handle = NULL;
|
||||||
|
esp_err_t ret = ESP_FAIL;
|
||||||
|
bool calibrated = false;
|
||||||
|
|
||||||
|
#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
|
||||||
|
if (!calibrated) {
|
||||||
|
ESP_LOGI(TAG, "calibration scheme version is %s", "Curve Fitting");
|
||||||
|
adc_cali_curve_fitting_config_t cali_config = {
|
||||||
|
.unit_id = unit,
|
||||||
|
.chan = channel,
|
||||||
|
.atten = atten,
|
||||||
|
.bitwidth = ADC_BITWIDTH_DEFAULT,
|
||||||
|
};
|
||||||
|
ret = adc_cali_create_scheme_curve_fitting(&cali_config, &handle);
|
||||||
|
if (ret == ESP_OK) {
|
||||||
|
calibrated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
|
||||||
|
if (!calibrated) {
|
||||||
|
ESP_LOGI(TAG, "calibration scheme version is %s", "Line Fitting");
|
||||||
|
adc_cali_line_fitting_config_t cali_config = {
|
||||||
|
.unit_id = unit,
|
||||||
|
.atten = atten,
|
||||||
|
.bitwidth = ADC_BITWIDTH_DEFAULT,
|
||||||
|
};
|
||||||
|
ret = adc_cali_create_scheme_line_fitting(&cali_config, &handle);
|
||||||
|
if (ret == ESP_OK) {
|
||||||
|
calibrated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
*out_handle = handle;
|
||||||
|
if (ret == ESP_OK) {
|
||||||
|
ESP_LOGI(TAG, "Calibration Success");
|
||||||
|
} else if (ret == ESP_ERR_NOT_SUPPORTED || !calibrated) {
|
||||||
|
ESP_LOGW(TAG, "eFuse not burnt, skip software calibration");
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG, "Invalid arg or no memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
return calibrated;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void adc_calibration_deinit(adc_cali_handle_t handle)
|
||||||
|
{
|
||||||
|
#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
|
||||||
|
ESP_LOGI(TAG, "deregister %s calibration scheme", "Curve Fitting");
|
||||||
|
ESP_ERROR_CHECK(adc_cali_delete_scheme_curve_fitting(handle));
|
||||||
|
|
||||||
|
#elif ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
|
||||||
|
ESP_LOGI(TAG, "deregister %s calibration scheme", "Line Fitting");
|
||||||
|
ESP_ERROR_CHECK(adc_cali_delete_scheme_line_fitting(handle));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
// Initialize LED
|
// Initialize LED
|
||||||
|
Reference in New Issue
Block a user