Fix Sensor
All checks were successful
Test compiling project / test (push) Successful in 2m46s

This commit is contained in:
2025-04-18 20:57:09 +02:00
parent 82455c830f
commit 0f581a54c5
5 changed files with 13 additions and 5 deletions

View File

@@ -117,7 +117,7 @@ float INA233::getBusVoltage() {
float INA233::getShuntVoltage() {
uint16_t rawVoltage = get_word(INA233::_address, REGISTER_READ_VSHUNT);
float voltage = rawVoltage * pow(10,-4);
float voltage = rawVoltage * 2.5e-6;
return voltage;
}
@@ -186,4 +186,8 @@ uint16_t INA233::getConfigRegister() {
void INA233::reset() {
sendByte(INA233::_address, 0x12, 0x00);
}
void INA233::setCalibrationRegister(int value) {
sendWord(INA233::_address, 0xD4, value);
}

View File

@@ -49,6 +49,8 @@ class INA233{
void reset();
void setCalibrationRegister(int value);
bool isConnected(void);
private:

View File

@@ -25,7 +25,7 @@ lib_deps =
https://github.com/tobimai/elog.git#fix-syslog
board_build.partitions = default.csv
upload_protocol = espota
upload_port = 10.1.60.43
upload_port = 192.168.5.205
build_flags = -Wall -Wextra -DLOGGING_SPIFFS_DISABLE -DLOGGING_SD_DISABLE
[env:ESP32_INA226]

View File

@@ -65,8 +65,8 @@ void wifi_task(void* parameter)
wifi_data.network_name = WiFi.SSID();
wifi_data.ip_address = WiFi.localIP().toString();
// LOG(DEBUG, "RSSI: %F, IP Address, %p, SSID: %s", float(WiFi.RSSI()), WiFi.localIP(), prefs.getString(ssid_key, "NOSSID"));
// Serial.println(WiFi.channel());
LOG(DEBUG, "RSSI: %F, IP Address, %p, SSID: %s", float(WiFi.RSSI()), WiFi.localIP(), prefs.getString(ssid_key, "NOSSID"));
Serial.println(WiFi.channel());
delay(5000);
} else {
LOG(DEBUG, "Connecting to %s using password %s", prefs.getString(ssid_key, ""), prefs.getString(wifi_password_key, ""));
@@ -88,7 +88,8 @@ void ethernet_task(void* parameter)
ethernet_data.link = ETH.linkUp();
ethernet_data.rssi = ETH.linkSpeed();
ethernet_data.ip_address = ETH.localIP().toString();
// LOG(DEBUG, "Ethernet RSSI: %F, IP Address, %s, LINK: %s", float(ethernet_data.rssi), ethernet_data.ip_address, String(ethernet_data.link));
Serial.println( ETH.localIP().toString());
LOG(DEBUG, "Ethernet RSSI: %F, IP Address, %s, LINK: %s", float(ethernet_data.rssi), ETH.localIP().toString().c_str(), String(ethernet_data.link));
delay(60 * 1000);
}
}

View File

@@ -37,6 +37,7 @@ void init_sensor(){
ina_sensor.setShuntVoltageConversionTime(conversion_time_8244uS);
ina_sensor.setBusVoltageConversionTime(conversion_time_8244uS);
ina_sensor.setAveragingMode(averages_128);
ina_sensor.setCalibrationRegister(128);
#endif
}