From 3b061a070712550557be1850d6f56486a35ac0ba Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Thu, 16 May 2024 15:56:10 +0200 Subject: [PATCH] combine two for-loops into one waste of time with two for-loops --- src/plugins/zeroExport/zeroExport.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index 97353a6a..afd15205 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -106,18 +106,14 @@ class ZeroExport { return; } - // Calc Data->groupPower + uint16_t groupPower = 0; - for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { - groupPower += mCfg->groups[group].inverters[inv].power; - } - mLog["gP"] = groupPower; - - // Calc Data->groupLimit uint16_t groupLimit = 0; for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { - groupLimit += mCfg->groups[group].inverters[inv].limit; + groupPower += mCfg->groups[group].inverters[inv].power; // Calc Data->groupPower + groupLimit += mCfg->groups[group].inverters[inv].limit; // Calc Data->groupLimit } + mLog["gP"] = groupPower; mLog["gL"] = groupLimit; // Batteryprotection