diff --git a/README.md b/README.md index 5e47d1c..c277985 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Webserver API +## Webserver The web server is implemented on the ESP32 and provides various endpoints for operation and display of information. Here are the defined URLs and their functions: @@ -32,7 +32,7 @@ This is an example of a JSON object containing various measurement values and co "ina226Status": 3, "ina226ShuntValue": 0.0002, "ina226AlertFlag": 0, - "ina226AlertLimit": 0.1, + "ina226AlertLimit": 0, "ina226CurrentLSB": 0.0005 } ``` @@ -52,6 +52,44 @@ This is an example of a JSON object containing various measurement values and co - `ina226AlertLimit`: The limit value for alerts from the INA226 chip. - `ina226CurrentLSB`: The value of the least significant bit (LSB) for the current according to the INA226 chip in amperes. +### Error codes in `errorCode` + +The variable `globalError` is used as a bitmask, where each bit represents a specific error condition. Here are the possible error codes and their meanings: +#### Error Codes + +| Descriptive Name | Value | Meaning | +|:----------------------------|---------:|:---------------------------------------------------------| +| `ERROR_NONE` | 0b00000000 | No error. The device is functioning properly, there are no errors present. | +| `ERROR_MAX_CURRENT_EXCEEDED`| 0b00000001 | The maximum current consumption has been exceeded. There might be an overload condition on the device. | +| `ERROR_CURRENT_BELOW_MIN` | 0b00000010 | The current consumption is below the permissible minimum. There may be an issue with the power supply. | +| `ERROR_MAX_TEMP_EXCEEDED` | 0b00000100 | The maximum temperature has been exceeded. The device could overheat. | +| `ERROR_TEMP_BELOW_MIN` | 0b00001000 | The temperature is below the permissible minimum. There is a risk of hypothermia or other temperature-related issues. | +| `ERROR_MAX_HUMI_EXCEEDED` | 0b00010000 | The maximum humidity has been exceeded. This could lead to moisture-related problems. | +| `ERROR_HUMI_BELOW_MIN` | 0b00100000 | The humidity is below the permissible minimum. There is a risk of low humidity. | + +Please note that multiple errors can occur simultaneously as the bitmasks can be combined. For example, `ERROR_MAX_TEMP_EXCEEDED | ERROR_MAX_HUMI_EXCEEDED` could indicate that both the maximum temperature and humidity have been exceeded. + +#### Error codes ina226Status + +| descriptive name error | value | meaning | +|:------------------------------|---------:|:----------| +| INA226_ERR_NONE | 0x0000 | OK +| INA226_ERR_SHUNTVOLTAGE_HIGH | 0x8000 | maxCurrent \* shunt > 80 mV +| INA226_ERR_MAXCURRENT_LOW | 0x8001 | maxCurrent < 0.001 +| INA226_ERR_SHUNT_LOW | 0x8002 | shunt < 0.001 +| INA226_ERR_NORMALIZE_FAILED | 0x8003 | not possible to normalize. + +#### Error codes ina226AlertLimit + +| description alert register | value | a.k.a. | +|:---------------------------|-------:| -------:| +| INA226_SHUNT_OVER_VOLTAGE | 0x8000 | SOL | +| INA226_SHUNT_UNDER_VOLTAGE | 0x4000 | SUL | +| INA226_BUS_OVER_VOLTAGE | 0x2000 | BOL | +| INA226_BUS_UNDER_VOLTAGE | 0x1000 | BUL | +| INA226_POWER_OVER_LIMIT | 0x0800 | POL | +| INA226_CONVERSION_READY | 0x0400 | | + 3. **`/config`** - **Output:** HTML page for configuration. - **Return:** Webpage with form fields for configuring parameters. @@ -120,40 +158,6 @@ This is an example of a JSON object containing various measurement values and co These URL paths form a basic API for interacting with the ESP32 device, allowing users to display real-time data, configure settings, initiate demo modes, and update the firmware. -### Error codes in `errorCode` - -The variable `globalError` is used as a bitmask, where each bit represents a specific error condition. Here are the possible error codes and their meanings: - -#### `ERROR_NONE` (0b0000000000000000) - -No error. The device is functioning properly, there are no errors present. - -#### `ERROR_MAX_CURRENT_EXCEEDED` (0b0000000000000001) - -The maximum current consumption has been exceeded. There might be an overload condition on the device. - -#### `ERROR_CURRENT_BELOW_MIN` (0b0000000000000010) - -The current consumption is below the permissible minimum. There may be an issue with the power supply. - -#### `ERROR_MAX_TEMP_EXCEEDED` (0b0000000000000100) - -The maximum temperature has been exceeded. The device could overheat. - -#### `ERROR_TEMP_BELOW_MIN` (0b0000000000001000) - -The temperature is below the permissible minimum. There is a risk of hypothermia or other temperature-related issues. - -#### `ERROR_MAX_HUMI_EXCEEDED` (0b0000000000010000) - -The maximum humidity has been exceeded. This could lead to moisture-related problems. - -#### `ERROR_HUMI_BELOW_MIN` (0b0000000000100000) - -The humidity is below the permissible minimum. There is a risk of low humidity. - -Please note that multiple errors can occur simultaneously as the bitmasks can be combined. For example, `ERROR_MAX_TEMP_EXCEEDED | ERROR_MAX_HUMI_EXCEEDED` could indicate that both the maximum temperature and humidity have been exceeded. - ## Functions ### configureIna226()