main/task_user.c

changeset 56
8c88a3d8ecf2
parent 55
43362bb8f3c0
child 57
232f318a6b51
equal deleted inserted replaced
55:43362bb8f3c0 56:8c88a3d8ecf2
1081 case ML2_ZERO_UNIT1: 1081 case ML2_ZERO_UNIT1:
1082 case ML2_ZERO_UNIT2: 1082 case ML2_ZERO_UNIT2:
1083 case ML2_ZERO_UNIT3: 1083 case ML2_ZERO_UNIT3:
1084 idx = Main_Loop2 - ML2_ZERO_UNIT1; 1084 idx = Main_Loop2 - ML2_ZERO_UNIT1;
1085 if (SubMenu == 0) { 1085 if (SubMenu == 0) {
1086 if (xSemaphoreTake(xSemaphoreUnits, 25) == pdTRUE && 1086 if (xSemaphoreTake(xSemaphoreUnits, 25) == pdTRUE && xSemaphoreTake(xSemaphoreADC, 10) == pdTRUE) {
1087 xSemaphoreTake(xSemaphoreADC, 10) == pdTRUE && 1087 if (adc_state->Pressure[idx].voltage > 165 && adc_state->Pressure[idx].voltage < 660) {
1088 adc_state->Pressure[idx].voltage > 165 && 1088 units[idx].pressure_zero = adc_state->Pressure[idx].voltage / (adc_state->Batt_voltage / 1000);
1089 adc_state->Pressure[idx].voltage < 660) { 1089 write_units();
1090 units[idx].pressure_zero = adc_state->Pressure[idx].voltage / (adc_state->Batt_voltage / 1000); 1090 ESP_LOGI(TAG, "Zero set unit %d, %d mV set %d", idx, adc_state->Pressure[idx].voltage, units[idx].pressure_zero);
1091 write_units(); 1091 }
1092 xSemaphoreGive(xSemaphoreADC); 1092 xSemaphoreGive(xSemaphoreADC);
1093 xSemaphoreGive(xSemaphoreUnits); 1093 xSemaphoreGive(xSemaphoreUnits);
1094 ESP_LOGI(TAG, "Zero set unit %d, %d mV set %d", idx, adc_state->Pressure[idx].voltage, units[idx].pressure_zero);
1095 screen_unit_zero(idx, SubMenu); 1094 screen_unit_zero(idx, SubMenu);
1096 if (Main_Loop1 == ML1_DONE) 1095 if (Main_Loop1 == ML1_DONE)
1097 Main_Loop1 = ML1_INIT; 1096 Main_Loop1 = ML1_INIT;
1098 } 1097 }
1099 } else if (SubMenu == 1) { 1098 } else if (SubMenu == 1) {

mercurial