Skip to content

Commit

Permalink
Merge pull request #35 from gropi75/Development
Browse files Browse the repository at this point in the history
Dynamic load calculation updated
  • Loading branch information
gropi75 authored Dec 3, 2023
2 parents 4ed46c4 + d45af53 commit e4268fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,6 @@ lib/secrets.h
.pio/build/bsc/firmware.bin
.pio/build/bsc/idedata.json
.pio/build/bsc/partitions.bin
.pio/libdeps/esp32dev/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp
.pio/libdeps/esp32dev/ArduinoJson/src/ArduinoJson/Strings/StringTraits.hpp
.pio/libdeps/esp32dev/ArduinoJson/src/ArduinoJson/Strings/Adapters/StringObject.hpp
17 changes: 6 additions & 11 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[env]
;platform = espressif32

platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
;platform_packages =
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master

framework = arduino
;board_build.partitions = partitions_fs.csv ; partitions.csv
Expand All @@ -30,32 +30,27 @@ extra_scripts = replace_fs.py
lib_deps =
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/tzapu/WiFiManager
;https://github.com/s00500/ESPUI
https://github.com/s00500/ESPUI.git

; https://github.com/sandeepmistry/arduino-CAN ; deactivated and replace by own fork
https://github.com/gropi75/arduino-CAN
https://github.com/gropi75/arduino-CAN ; own fork of the https://github.com/sandeepmistry/arduino-CAN
https://github.com/bblanchon/ArduinoJson
https://github.com/knolleary/pubsubclient
;https://github.com/marvinroger/async-mqtt-client
https://github.com/me-no-dev/AsyncTCP

https://github.com/adafruit/Adafruit_BusIO ; Uli added due to update of GFX Library (Display)
https://github.com/adafruit/Adafruit-GFX-Library.git ; Uli Displaydriver
https://github.com/adafruit/Adafruit_SSD1306.git ; Uli Displaydriver
https://github.com/arduino-libraries/NTPClient ; Uli 21.01. NTP Time client for Sunrise and sunset calculation




lib_ignore =
; ESP Async WebServer ; force the use of the esphome version
; AsyncTCP ; force the use of the esphome version
LittleFS_esp32 ; force the use of the ESP32 built into the core version


[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git ; using the latest version
platform = https://github.com/tasmota/platform-espressif32/releases/download/2022.12.0/platform-espressif32.zip

;platform = https://github.com/platformio/platform-espressif32.git ; using the latest version
board = nodemcu-32s ; esp32dev
;upload_port = COM3
upload_speed = 921600
Expand Down
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,11 +951,14 @@ namespace Main
// solar_prognosis = getSolarPrognosis(solarprognose_token, solarprognose_id, myTime.date_today, myTime.date_tomorrow);
date_dayofweek_today = myTime.day_of_week;
}
g_Time30Min = millis();
}

if (is_day != setPVstartflag(lagmorning, lagevening, laenge, breite))
// at sunrise and sunset execute the following section
if (is_day != setPVstartflag(lagmorning, lagevening, laenge, breite))
{
is_day = !(is_day);
if (!is_day) // execute at sunset
if (!is_day) // execute at sunset the calculation of the dynamic power for the night
{
BatteryCapacity = BMS.CellCount * BMS.Nominal_Capacity * 3.2 / 1000;
if (solar_prognosis < expDaytimeUsage)
Expand All @@ -971,9 +974,6 @@ namespace Main
DynPowerInv = CalculateBalancedDischargePower(BMS.Nominal_Capacity, BMS.Battery_Voltage, BMS.SOC, target_SOC, myTime.sunset_today, myTime.sunrise_tomorrow);
}
}

g_Time30Min = millis();
}
}

// Most UI elements are assigned this generic callback which prints some
Expand Down

0 comments on commit e4268fd

Please sign in to comment.