Skip to content

Commit a30e43b

Browse files
committed
clean-up some code
1 parent b543df2 commit a30e43b

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

ad7811/ad7811.c

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Created on: Nov 30, 2023
55
* Author: viorel_serbu
66
*/
7+
#include "freertos/projdefs.h"
78
#include "project_specific.h"
89
#ifdef ADC_AD7811
910
#include <stdio.h>
@@ -27,7 +28,6 @@
2728
#include "spicom.h"
2829
#include "ad7811.h"
2930

30-
3131
static const char* TAG = "AD op:";
3232
static int vref;
3333
static gptimer_handle_t adc_timer;
@@ -235,6 +235,7 @@ int do_ad(int argc, char **argv)
235235
int nerrors = arg_parse(argc, argv, (void **)&ad_args);
236236
int chnn, nrs;
237237
int16_t s_data[200];
238+
int data;
238239
int dbin;
239240
if (nerrors != 0)
240241
{
@@ -251,10 +252,14 @@ int do_ad(int argc, char **argv)
251252
nrs = ad_args.arg1->ival[0];
252253
else
253254
nrs = 1;
254-
adc_get_data(chnn, s_data, nrs);
255+
//adc_get_data(chnn, s_data, nrs);
255256
for(int i = 0; i < nrs; i++)
256-
read_ADmv(chnn, (int *)&s_data[i], &dbin);
257-
ESP_LOGI(TAG, "chn: %d = %d / %d, %d, %d, %d", chnn, s_data[0], s_data[1], s_data[2], s_data[3], s_data[4]);
257+
{
258+
read_ADmv(chnn, &data, &dbin);
259+
ESP_LOGI(TAG, "chn: %d = %d", chnn, data);
260+
vTaskDelay(pdMS_TO_TICKS(50));
261+
}
262+
//ESP_LOGI(TAG, "chn: %d = %d / %d, %d, %d, %d", chnn, s_data[0], s_data[1], s_data[2], s_data[3], s_data[4]);
258263
}
259264
else if(strcmp(ad_args.op->sval[0], "mr") == 0)
260265
{

comm/spicom.c

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <stdio.h>
1010
#include <string.h>
11+
12+
#ifdef ADC_7811
1113
#include "soc/gpio_reg.h"
1214
#include "soc/dport_access.h"
1315
#include "driver/spi_master.h"
@@ -135,3 +137,4 @@ void register_spi()
135137
};
136138
ESP_ERROR_CHECK(esp_console_cmd_register(&spi_cmd));
137139
}
140+
#endif

gpios.xlsx

978 KB
Binary file not shown.

utils/utils.c

+2-11
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,7 @@
2727
#include "external_defs.h"
2828
#include "tcp_log.h"
2929
#include "project_specific.h"
30-
#ifdef ADC_7811
31-
#include "adc7811.h"
32-
#elif defined ADC_ESP32
33-
#include "adc_op.h"
34-
#endif
35-
#if ACTIVE_CONTROLLER == PUMP_CONTROLLER || ACTIVE_CONTROLLER == WP_CONTROLLER
36-
//#include "adc_op.h"
37-
#include "pumpop.h"
38-
#endif
30+
3931

4032
#if ACTIVE_CONTROLLER == WESTA_CONTROLLER
4133
#include "westaop.h"
@@ -230,9 +222,8 @@ int spiffs_storage_check()
230222
//esp_vfs_spiffs_unregister(conf.partition_label);
231223
return ret;
232224
}
233-
else
234-
ESP_LOGI(TAG, "SPIFFS_check() successful");
235225
}
236226
}
227+
ESP_LOGI(TAG, "SPIFFS_check() successful");
237228
return ESP_OK;
238229
}

0 commit comments

Comments
 (0)