current conversion

This commit is contained in:
leo 2023-06-15 13:04:14 +02:00
parent a18274bec0
commit 3efc86edf4
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB
3 changed files with 4 additions and 1 deletions

View File

@ -5,4 +5,5 @@
typedef struct {
uint32_t refresh_delay;
uint32_t* offsets;
int range;
} configuration;

View File

@ -13,7 +13,7 @@
static struct char_pres_format current_char_pres_format = {
.format = FORMAT_UINT32,
.exponent = -3,
.exponent = -6,
.unit = AMPERE_UNIT_UUID,
.namespc = 1,
.descrH = NSP_DESC_MAIN & 0xff,

View File

@ -125,6 +125,7 @@ void app_main(void){
configuration main_conf = {
.refresh_delay = 1000,
.offsets = offsets,
.range = R100,
};
uint32_t meas_volts[INPUTS_NUM];
@ -157,6 +158,7 @@ void app_main(void){
ESP_ERROR_CHECK(adc_cali_raw_to_voltage(adc_conv_h[i], val, &mv));
ESP_LOGI(TAG, "IN %d : %d mV (%lu / %lu)", i, mv, meas_res_buff[i], meas_nb_buff[i]);
meas_volts[i] = mv;
meas_amp[i] = mv * 1000000 / ranges[main_conf.range].resistance;
}
notify_update(&meas);