Skip to content

Commit

Permalink
updates C6 and C2 support (#19326)
Browse files Browse the repository at this point in the history
* Improvements to thermostat debug output (#19279)

* add: update DEBUG_THERMOSTAT to only control the virtual switch

Also, debug output is still generated but end user can control this debug level 3

* add: debug output of main controller parameters when thermostat enabled

Also, add units for debug outputs added to make them more intelligible

* Update xdrv_39_thermostat.ino

* add: debug message when sensor is detected as not alive

fix: display thermostat number in debug messages

* add: log message prefix string for thermostat

* Update xdrv_39_thermostat.ino

fix: typos in comments
add: debug messages

* add: debug prefix for thermostat

* add: debug prefix added to output lines

* fix: comment typos and small grammatical changes for clarity

* add: debug prefix 'THE' added to debug output

* add section safeboot_flags in platform_tasmota32.ini (#19281)

This will make it easier to ignore a bunch of libraries in order to speed up builds without polluting the ENV sections too much.

Usage:
[env:my_safeboot_env]
lib_ignore              = ${safeboot_flags.lib_ignore}

* use common safeboot flags (#19282)

* fix IRAM_ATTR specified both in function declaration and definition (#19286)

* Improvements to PID controller driver (#19285)

* add: update DEBUG_THERMOSTAT to only control the virtual switch

Also, debug output is still generated but end user can control this debug level 3

* add: debug output of main controller parameters when thermostat enabled

Also, add units for debug outputs added to make them more intelligible

* Update xdrv_39_thermostat.ino

* add: debug message when sensor is detected as not alive

fix: display thermostat number in debug messages

* add: log message prefix string for thermostat

* Update xdrv_39_thermostat.ino

fix: typos in comments
add: debug messages

* add: debug prefix for thermostat

* add: debug prefix added to output lines

* fix: comment typos and small grammatical changes for clarity

* add: debug prefix 'THE' added to debug output

* add:  display PID status and key info on web output

* fix: remove extraneous comments that included unused code fragments

* add: local sensor handling improvements

add: define a local sensor name
add: define the local sensor measurement parameter
add: limit sensor not seen error message to every 60 seconds to avoid flooding the logs
add: include interval since which sensor data was last updated
fix: properly update the maximum interval time so missing sensor data is properly alerted

* Update xdrv_49_pid.ino

* Typo architceture → architecture (#19288)

* avoid unnecessary compiling of specific libraries in lib32_div for most builds (#19293)

* ESP32: pass flashmode at build time to macro definition (#19299)

* pass flashmode at build time to macro definition

* fix 8266 builds

* fix: properly detect device is offline after maximum misses reached (#19298)

* Update changelogs

* [DS18x20] Enhance use of aliases (#19026)

* [DS18x20] Enhance use of aliases

`defineDS18x20_USE_ID_AS_NAME`:
Always show part of the address, even for one sensor
`#define DS18x20_USE_ID_ALIAS`:
The command `DS18Alias` can now be use with alphanumeric aliases, which replace the sensor name

* [DS18x20] change to calloc()

* fix OneWire for IDF5.1 and C2/C6 (#19303)

* fix OneWire for IDF5.1 and C2/C6

* Use Onewire in arduino30 builds

* use SOC specific defines for C2,C3 and C6

* Removes software based no load threshold. (#19302)

Lowers ADE7953 builtin no load detection threshold to be able to measure 5 watt power levels.

* Update changelogs

* Creates a place to put the customer boards (#19309)

* Add commands to allow setting of timeprop parameters (#19310)

* add: commands to set timeprop settings

* Update my_user_config.h

* fix: properly generated json response to commands

* Sync dev with release v13.1

* Update platformio_tasmota32.ini (#19313)

* add: shutdown command for PID controller (#19318)

* C6 and C2 support (#363)

* Initial C6 support

* add C6 in tasmota_globals.h

* fix copy&paste errors

* Use updated platform (build 1481)

* use common safeboot flags (#19282) (#352)

Co-authored-by: Christian Baars <baars@klinikum-brandenburg.de>

* use env var lib_ignore

* safeboot lib_ignore env

* revert wrong change

* rm eink lib from standard used libs

* add c2-board 4M, maximum_size probably a bit off

* diffuse idea for 2MB with OTA and FS

* C2 and C6 additions

* C2 and C6 additions for commands.ino

* C2 and C6 additions for crash recorder

* C2 to support_esp

* some preps for C2

* add c2 to tasmota.h

* fix some typos and compile bugs

* fix 2 compiler warnings for Arduino 3.0

* fix another warning

* add correct pins to template

* pins for C2, maximum_size updated

* unclutter env:tasmota32c2-safeboot

* fix c6 env

* more pins for the C2, but not all

* pin 9 and 10 for c2/c6

* add ||

* prep pins for c6

* make c6 compile, needs testing

* fix copy-paste-error

* more correct pin support C6

* pin14 C6

* wrong warning for C6

* 10 and 11 are flash pins on the C6

* boolean voodoo

* fix EVERYTHING

* fix Onewire for Arduino 3.0

* enable OneWire

* finale fix for all platforms: OneWire.h

* better compatibility

* final fix onewire

* refactor Platformio Arduino 3.0 setup

* overlooked needed `;`

* refactor as requested

* fix NeoPixelBus compilation for C2 and C6

* fix Arduino30 for old working NeoPixel boards

* Try to switch of RMT LED when not SOC supported

* use latest IDF 5.1

* framework includes now "libsodium"

* prep NeoPixel RMT rewrite

* NeoPixel for C6

* fix Arduino 2.x

* really fix compile ??

* fix compiler warning TSL2591

* fix compiler warning TSL2591 _2

* fix compile warning TSL2561

* fix warning sensirion part 1

* fix ESP32 Arduino 3.0 compile (needs work check)

* Disable NeoPixel for C2 (no RMT support)

* forgotten to remove

* fix compiler warning

* prep 5.1, TasUpdater

* prep 5.1 SensirionRXFrame

* prep 5.1, SensiriomI2CCommunication.cpp

* prep5.1, last batch Sensirion

* prep5.1, silence compiler warning

* Silence C++ deprecated warning

* Align with branch C6-support (#359)

* prep5.1, fix berry_wire

* revert deprecated compiler flag

---------

Co-authored-by: Staars <baars@klinikum-brandenburg.de>
Co-authored-by: Christian Baars <Baars@gmx.de>

* add i2c #defines

* enable more libs for ESP32

* refactor for esp-nimble-cpp

* add esp-nimble-cpp, needed for C2,C6

* fix dual use of IRAM_ATTR for i2sDmaISR

* silence compiler warning with cast

* prep5.1, new DAC API in Berry

* more libs enabled

* NimBLE changes

* fix wrong build flag for MI

* add NimBLE ignores

* add MI to env

* use latest framework with changed NimBLE

* add libesp32_div to C2/C6

* fix env konfig for NimBLE

* new esp-cpp-nimble for all

---------

Co-authored-by: Christian Baars <baars@klinikum-brandenburg.de>
Co-authored-by: Christian Baars <Baars@gmx.de>

---------

Co-authored-by: Paul Blacknell <blacknell@users.noreply.github.com>
Co-authored-by: Christian Baars <baars@klinikum-brandenburg.de>
Co-authored-by: Дилян Палаузов <dpa-github@aegee.org>
Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>
Co-authored-by: SteWers <42718143+SteWers@users.noreply.github.com>
Co-authored-by: paulusbrand <75862178+paulusbrand@users.noreply.github.com>
Co-authored-by: Martin <79449686+marsman7@users.noreply.github.com>
Co-authored-by: Christian Baars <Baars@gmx.de>
  • Loading branch information
9 people authored Aug 16, 2023
1 parent 09feb95 commit 9c88303
Show file tree
Hide file tree
Showing 146 changed files with 22,411 additions and 76 deletions.
2 changes: 1 addition & 1 deletion lib/lib_basic/NeoPixelBus/src/internal/Esp32_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static i2s_bus_t I2S[I2S_NUM_MAX] = {
};
#endif

void IRAM_ATTR i2sDmaISR(void* arg);
void i2sDmaISR(void* arg);

bool i2sInitDmaItems(uint8_t bus_num) {
if (bus_num >= I2S_NUM_MAX) {
Expand Down
20 changes: 10 additions & 10 deletions lib/lib_i2c/Sensirion_Core/src/SensirionI2CCommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ uint16_t SensirionI2CCommunication::sendFrame(uint8_t address,
size_t writtenBytes = i2cBus.write(frame._buffer, frame._index);
uint8_t i2c_error = i2cBus.endTransmission();
if (writtenBytes != frame._index) {
return WriteError | I2cOtherError;
return static_cast<uint16_t>(WriteError) | static_cast<uint16_t>(I2cOtherError);
}
// translate Arduino errors, see
// https://www.arduino.cc/en/Reference/WireEndTransmission
switch (i2c_error) {
case 0:
return NoError;
case 1:
return WriteError | InternalBufferSizeError;
return static_cast<uint16_t>(WriteError) | static_cast<uint16_t>(InternalBufferSizeError);
case 2:
return WriteError | I2cAddressNack;
return static_cast<uint16_t>(WriteError) | static_cast<uint16_t>(I2cAddressNack);
case 3:
return WriteError | I2cDataNack;
return static_cast<uint16_t>(WriteError) | static_cast<uint16_t>(I2cDataNack);
default:
return WriteError | I2cOtherError;
return static_cast<uint16_t>(WriteError) | static_cast<uint16_t>(I2cOtherError);
}
}

Expand All @@ -89,19 +89,19 @@ uint16_t SensirionI2CCommunication::receiveFrame(uint8_t address,
#endif

if (numBytes % 3) {
return ReadError | WrongNumberBytesError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(WrongNumberBytesError);
}
if ((numBytes / 3) * 2 > frame._bufferSize) {
return ReadError | BufferSizeError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(BufferSizeError);
}
if (numBytes > sizeBuffer) {
return ReadError | InternalBufferSizeError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(InternalBufferSizeError);
}

readAmount = i2cBus.requestFrom(address, static_cast<uint8_t>(numBytes),
static_cast<uint8_t>(true));
if (numBytes != readAmount) {
return ReadError | NotEnoughDataError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(NotEnoughDataError);
}
do {
frame._buffer[i++] = i2cBus.read();
Expand All @@ -110,7 +110,7 @@ uint16_t SensirionI2CCommunication::receiveFrame(uint8_t address,
uint8_t expectedCRC = generateCRC(&frame._buffer[i - 2], 2, poly);
if (actualCRC != expectedCRC) {
clearRxBuffer(i2cBus);
return ReadError | CRCError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(CRCError);
}
readAmount -= 3;
} while (readAmount > 0);
Expand Down
6 changes: 3 additions & 3 deletions lib/lib_i2c/Sensirion_Core/src/SensirionI2CTxFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ SensirionI2CTxFrame SensirionI2CTxFrame::createWithUInt16Command(

uint16_t SensirionI2CTxFrame::addCommand(uint16_t command) {
if (_bufferSize < 2) {
return TxFrameError | BufferSizeError;
return static_cast<uint16_t>(TxFrameError) | static_cast<uint16_t>(BufferSizeError);
}
_buffer[0] = static_cast<uint8_t>((command & 0xFF00) >> 8);
_buffer[1] = static_cast<uint8_t>((command & 0x00FF) >> 0);
Expand Down Expand Up @@ -130,12 +130,12 @@ uint16_t SensirionI2CTxFrame::addBytes(const uint8_t data[],

uint16_t SensirionI2CTxFrame::_addByte(uint8_t data) {
if (_bufferSize <= _index) {
return TxFrameError | BufferSizeError;
return static_cast<uint16_t>(TxFrameError) | static_cast<uint16_t>(BufferSizeError);
}
_buffer[_index++] = data;
if ((_index - _numCommandBytes) % 3 == 2) {
if (_bufferSize <= _index) {
return TxFrameError | BufferSizeError;
return static_cast<uint16_t>(TxFrameError) | static_cast<uint16_t>(BufferSizeError);
}
uint8_t crc = generateCRC(&_buffer[_index - 2], 2, _polynomial_type);
_buffer[_index++] = crc;
Expand Down
12 changes: 6 additions & 6 deletions lib/lib_i2c/Sensirion_Core/src/SensirionRxFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SensirionRxFrame::SensirionRxFrame(uint8_t buffer[], size_t bufferSize)

uint16_t SensirionRxFrame::getUInt32(uint32_t& data) {
if (_numBytes < 4) {
return RxFrameError | NoDataError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(NoDataError);
}
data = static_cast<uint32_t>(_buffer[_index++]) << 24;
data |= static_cast<uint32_t>(_buffer[_index++]) << 16;
Expand All @@ -61,7 +61,7 @@ uint16_t SensirionRxFrame::getInt32(int32_t& data) {

uint16_t SensirionRxFrame::getUInt16(uint16_t& data) {
if (_numBytes < 2) {
return RxFrameError | NoDataError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(NoDataError);
}
data = static_cast<uint16_t>(_buffer[_index++]) << 8;
data |= static_cast<uint16_t>(_buffer[_index++]);
Expand All @@ -78,7 +78,7 @@ uint16_t SensirionRxFrame::getInt16(int16_t& data) {

uint16_t SensirionRxFrame::getUInt8(uint8_t& data) {
if (_numBytes < 1) {
return RxFrameError | NoDataError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(NoDataError);
}
data = _buffer[_index++];
_numBytes -= 1;
Expand All @@ -87,7 +87,7 @@ uint16_t SensirionRxFrame::getUInt8(uint8_t& data) {

uint16_t SensirionRxFrame::getInt8(int8_t& data) {
if (_numBytes < 1) {
return RxFrameError | NoDataError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(NoDataError);
}
data = static_cast<int8_t>(_buffer[_index++]);
_numBytes -= 1;
Expand All @@ -96,7 +96,7 @@ uint16_t SensirionRxFrame::getInt8(int8_t& data) {

uint16_t SensirionRxFrame::getBool(bool& data) {
if (_numBytes < 1) {
return RxFrameError | NoDataError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(NoDataError);
}
data = static_cast<bool>(_buffer[_index++]);
_numBytes -= 1;
Expand All @@ -115,7 +115,7 @@ uint16_t SensirionRxFrame::getFloat(float& data) {

uint16_t SensirionRxFrame::getBytes(uint8_t data[], size_t maxBytes) {
if (_numBytes < 1) {
return RxFrameError | NoDataError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(NoDataError);
}
size_t readAmount = maxBytes;
if (_numBytes < maxBytes) {
Expand Down
18 changes: 9 additions & 9 deletions lib/lib_i2c/Sensirion_Core/src/SensirionShdlcCommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static uint16_t readByte(uint8_t& data, Stream& serial, unsigned long startTime,
unsigned long timeoutMicros) {
do {
if (micros() - startTime > timeoutMicros) {
return ReadError | TimeoutError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(TimeoutError);
}
} while (!serial.available());
data = serial.read();
Expand Down Expand Up @@ -70,7 +70,7 @@ uint16_t SensirionShdlcCommunication::sendFrame(SensirionShdlcTxFrame& frame,
Stream& serial) {
size_t writtenBytes = serial.write(&frame._buffer[0], frame._index);
if (writtenBytes != frame._index) {
return WriteError | SerialWriteError;
return static_cast<uint16_t>(WriteError) | static_cast<uint16_t>(SerialWriteError);
}
return NoError;
}
Expand All @@ -83,7 +83,7 @@ uint16_t SensirionShdlcCommunication::receiveFrame(
uint8_t current = 0;

if (frame._numBytes) {
return ReadError | NonemptyFrameError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(NonemptyFrameError);
}

// Wait for start byte and ignore all other bytes in case a partial frame
Expand Down Expand Up @@ -121,7 +121,7 @@ uint16_t SensirionShdlcCommunication::receiveFrame(
frame._address + frame._command + frame._state + dataLength;

if (dataLength > frame._bufferSize) {
return RxFrameError | BufferSizeError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(BufferSizeError);
}

size_t i = 0;
Expand All @@ -142,7 +142,7 @@ uint16_t SensirionShdlcCommunication::receiveFrame(
return error;
}
if (expectedChecksum != actualChecksum) {
return ReadError | ChecksumError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(ChecksumError);
}

uint8_t stop;
Expand All @@ -151,10 +151,10 @@ uint16_t SensirionShdlcCommunication::receiveFrame(
return error;
}
if (stop != 0x7e) {
return ReadError | StopByteError;
return static_cast<uint16_t>(ReadError) | static_cast<uint16_t>(StopByteError);
}
if (frame._state & 0x7F) {
return ExecutionError | frame._state;
return static_cast<uint16_t>(ExecutionError) | frame._state;
}
frame._dataLength = dataLength;
frame._numBytes = dataLength;
Expand All @@ -175,10 +175,10 @@ uint16_t SensirionShdlcCommunication::sendAndReceiveFrame(
return error;
}
if (rxFrame.getCommand() != txFrame.getCommand()) {
return RxFrameError | RxCommandError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(RxCommandError);
}
if (rxFrame.getAddress() != txFrame.getAddress()) {
return RxFrameError | RxAddressError;
return static_cast<uint16_t>(RxFrameError) | static_cast<uint16_t>(RxAddressError);
}
return NoError;
}
4 changes: 4 additions & 0 deletions lib/libesp32/HttpClientLight/src/TasUpdater.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "TasUpdate.h"
#include "Arduino.h"
#if ESP_IDF_VERSION_MAJOR >= 5
#include "spi_flash_mmap.h"
#else
#include "esp_spi_flash.h"
#endif
#include "esp_ota_ops.h"
#include "esp_image_format.h"

Expand Down
2 changes: 1 addition & 1 deletion lib/libesp32/berry_mapping/src/be_class_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ int be_check_arg_type(bvm *vm, int arg_start, int argc, const char * arg_type, i
}
}
// berry_log_C(">> be_call_c_func arg %i, type %s", i, arg_type_check ? type_short_name : "<null>");
p[p_idx] = be_convert_single_elt(vm, i + arg_start, arg_type_check ? type_short_name : NULL, &buf_len);
p[p_idx] = be_convert_single_elt(vm, i + arg_start, arg_type_check ? type_short_name : NULL, (int*)&buf_len);
// berry_log_C("< ret[%i]=%i", p_idx, p[p_idx]);
p_idx++;

Expand Down
2 changes: 1 addition & 1 deletion lib/libesp32_div/NimBLE-Arduino/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "NimBLE-Arduino",
"keywords": "esp32, bluetooth",
"description": "Bluetooth low energy (BLE) library for arduino-esp32 based on NimBLE",
"version": "1.4.0",
"version": "1.4.1",
"frameworks": "arduino",
"platforms": "espressif32"
}
60 changes: 60 additions & 0 deletions lib/libesp32_div/esp-nimble-cpp/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on: [push, pull_request]

jobs:
build-esp-idf-component:
name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
runs-on: ubuntu-latest
strategy:
matrix:
# The version names here correspond to the versions of espressif/idf Docker image.
# See https://hub.docker.com/r/espressif/idf/tags and
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
# for details.
idf_ver: ["release-v4.4", "release-v5.1"]
idf_target: ["esp32", "esp32s3", "esp32c3", "esp32c6"]
example:
- Advanced/NimBLE_Client
- Advanced/NimBLE_Server
- basic/BLE_client
- basic/BLE_notify
- basic/BLE_scan
- basic/BLE_server
- basic/BLE_uart
- Bluetooth_5/NimBLE_extended_client
- Bluetooth_5/NimBLE_extended_server
- Bluetooth_5/NimBLE_multi_advertiser
exclude:
- idf_target: "esp32"
example: Bluetooth_5/NimBLE_extended_client
- idf_target: "esp32"
example: Bluetooth_5/NimBLE_extended_server
- idf_target: "esp32"
example: Bluetooth_5/NimBLE_multi_advertiser
- idf_ver: release-v4.4
idf_target: esp32c6

container: espressif/idf:${{ matrix.idf_ver }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: components/esp-nimble-cpp
- name: Build examples
env:
IDF_TARGET: ${{ matrix.idf_target }}
shell: bash
run: |
. ${IDF_PATH}/export.sh
cp -r components/esp-nimble-cpp/examples/* .
idf.py -C ${{ matrix.example }} -DEXTRA_COMPONENT_DIRS=$PWD/components build
build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Doxygen Action
uses: mattnotmitt/doxygen-action@v1.9.5
with:
working-directory: 'docs/'
1 change: 1 addition & 0 deletions lib/libesp32_div/esp-nimble-cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/doxydocs
Loading

0 comments on commit 9c88303

Please sign in to comment.