This commit is contained in:
@@ -117,7 +117,7 @@ float INA233::getBusVoltage() {
|
|||||||
|
|
||||||
float INA233::getShuntVoltage() {
|
float INA233::getShuntVoltage() {
|
||||||
uint16_t rawVoltage = get_word(INA233::_address, REGISTER_READ_VSHUNT);
|
uint16_t rawVoltage = get_word(INA233::_address, REGISTER_READ_VSHUNT);
|
||||||
float voltage = rawVoltage * pow(10,-4);
|
float voltage = rawVoltage * 2.5e-6;
|
||||||
|
|
||||||
return voltage;
|
return voltage;
|
||||||
}
|
}
|
||||||
@@ -186,4 +186,8 @@ uint16_t INA233::getConfigRegister() {
|
|||||||
|
|
||||||
void INA233::reset() {
|
void INA233::reset() {
|
||||||
sendByte(INA233::_address, 0x12, 0x00);
|
sendByte(INA233::_address, 0x12, 0x00);
|
||||||
|
}
|
||||||
|
|
||||||
|
void INA233::setCalibrationRegister(int value) {
|
||||||
|
sendWord(INA233::_address, 0xD4, value);
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,8 @@ class INA233{
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
void setCalibrationRegister(int value);
|
||||||
|
|
||||||
bool isConnected(void);
|
bool isConnected(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ lib_deps =
|
|||||||
https://github.com/tobimai/elog.git#fix-syslog
|
https://github.com/tobimai/elog.git#fix-syslog
|
||||||
board_build.partitions = default.csv
|
board_build.partitions = default.csv
|
||||||
upload_protocol = espota
|
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
|
build_flags = -Wall -Wextra -DLOGGING_SPIFFS_DISABLE -DLOGGING_SD_DISABLE
|
||||||
|
|
||||||
[env:ESP32_INA226]
|
[env:ESP32_INA226]
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ void wifi_task(void* parameter)
|
|||||||
wifi_data.network_name = WiFi.SSID();
|
wifi_data.network_name = WiFi.SSID();
|
||||||
wifi_data.ip_address = WiFi.localIP().toString();
|
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"));
|
LOG(DEBUG, "RSSI: %F, IP Address, %p, SSID: %s", float(WiFi.RSSI()), WiFi.localIP(), prefs.getString(ssid_key, "NOSSID"));
|
||||||
// Serial.println(WiFi.channel());
|
Serial.println(WiFi.channel());
|
||||||
delay(5000);
|
delay(5000);
|
||||||
} else {
|
} else {
|
||||||
LOG(DEBUG, "Connecting to %s using password %s", prefs.getString(ssid_key, ""), prefs.getString(wifi_password_key, ""));
|
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.link = ETH.linkUp();
|
||||||
ethernet_data.rssi = ETH.linkSpeed();
|
ethernet_data.rssi = ETH.linkSpeed();
|
||||||
ethernet_data.ip_address = ETH.localIP().toString();
|
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);
|
delay(60 * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,7 @@ void init_sensor(){
|
|||||||
ina_sensor.setShuntVoltageConversionTime(conversion_time_8244uS);
|
ina_sensor.setShuntVoltageConversionTime(conversion_time_8244uS);
|
||||||
ina_sensor.setBusVoltageConversionTime(conversion_time_8244uS);
|
ina_sensor.setBusVoltageConversionTime(conversion_time_8244uS);
|
||||||
ina_sensor.setAveragingMode(averages_128);
|
ina_sensor.setAveragingMode(averages_128);
|
||||||
|
ina_sensor.setCalibrationRegister(128);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user