Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 72ead29
Author: Frédéric Metrich <[email protected]>
Date:   Sun Jun 2 20:08:10 2024 +0200

    Update codeql.yml

    Signed-off-by: Frédéric Metrich <[email protected]>

commit 8539722
Author: Frédéric Metrich <[email protected]>
Date:   Sun Jun 2 10:30:01 2024 +0200

    Update build.yml

    Signed-off-by: Frédéric Metrich <[email protected]>

commit 57615b2
Author: Frédéric Metrich <[email protected]>
Date:   Sun Jun 2 10:26:12 2024 +0200

    Update build.yml

    Signed-off-by: Frédéric Metrich <[email protected]>

commit e6e7d96
Author: Frédéric Metrich <[email protected]>
Date:   Sun Jun 2 10:24:13 2024 +0200

    Update build.yml

    Signed-off-by: Frédéric Metrich <[email protected]>

commit ceb80c0
Author: Frédéric Metrich <[email protected]>
Date:   Sun Jun 2 10:21:11 2024 +0200

    Update build.yml

    Signed-off-by: Frédéric Metrich <[email protected]>

commit 0be5bd1
Author: Frédéric Metrich <[email protected]>
Date:   Sat Jun 1 18:37:06 2024 +0200

    Create build.yml

    Signed-off-by: Frédéric Metrich <[email protected]>

commit eff74e6
Author: Frédéric Metrich <[email protected]>
Date:   Thu May 30 09:27:57 2024 +0200

    Fix typo

commit 42da896
Author: Frédéric Metrich <[email protected]>
Date:   Fri Apr 19 06:55:34 2024 +0200

    Update documentation for Carte-relais pour sortie tout-ou-rien

commit eb3ee08
Author: Frédéric Metrich <[email protected]>
Date:   Sun Apr 14 11:52:43 2024 +0200

    Update documentation

commit 0c363e7
Author: Frédéric Metrich <[email protected]>
Date:   Fri Mar 29 19:35:29 2024 +0100

    Update Readme.md

    Signed-off-by: Frédéric Metrich <[email protected]>

commit 8913590
Author: Frédéric Metrich <[email protected]>
Date:   Tue Mar 26 09:55:56 2024 +0100

    Update documentation for ACI monophasée KITABLE and contacteur HC/HP

commit b0f0be1
Author: Frédéric Metrich <[email protected]>
Date:   Tue Mar 26 09:42:47 2024 +0100

    Update documentation for ACI monophasée KITABLE and contacteur HC/HP

commit 34dafad
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 24 12:40:28 2024 +0100

    Update documentation for ACI monophasée KITABLE and contacteur HC/HP

commit c5c3443
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 24 10:52:33 2024 +0100

    Update documentation for ACI monophasée KITABLE and contacteur HC/HP

commit d12997b
Author: Frédéric Metrich <[email protected]>
Date:   Sat Mar 23 17:43:09 2024 +0100

    Update documentation for ACI monophasée KITABLE and contacteur HC/HP

commit de19d26
Author: Frédéric Metrich <[email protected]>
Date:   Sat Mar 23 17:17:35 2024 +0100

    Refactor ACI monophasée KITABLE and contacteur HC/HP documentation

commit 4236d53
Author: Frédéric Metrich <[email protected]>
Date:   Fri Mar 22 23:28:43 2024 +0100

    Update documentation for ACI monophasée KITABLE and contacteur HC/HP

commit 47d759f
Author: Frédéric Metrich <[email protected]>
Date:   Tue Mar 19 22:26:24 2024 +0100

    Update type_traits.hpp

commit 49e30d0
Author: Frédéric Metrich <[email protected]>
Date:   Mon Mar 18 13:52:41 2024 +0100

    Fix DC offset calculation in processing.cpp

commit 3e4e999
Author: Frédéric Metrich <[email protected]>
Date:   Fri Mar 15 15:07:51 2024 +0100

    Some refactoring

commit 41b9ec6
Author: Frédéric Metrich <[email protected]>
Date:   Fri Mar 15 10:33:04 2024 +0100

    Fix platformio settings

commit 1e70fe2
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 18:30:35 2024 +0100

    Some fixes

commit 6d1bb8c
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 17:26:54 2024 +0100

    Some tiny refactoring

commit d34d9ab
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 16:37:36 2024 +0100

    Doc reformulée avec la généreuse contribution de l'IA :D

commit f17c67d
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 16:17:06 2024 +0100

    More doc

commit 7d07f91
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 10:02:01 2024 +0100

    Some doc fix

commit b250d67
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 08:46:10 2024 +0100

    Some doc

commit f1e487b
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 07:18:38 2024 +0100

    Update Readme.md

    Signed-off-by: Frédéric Metrich <[email protected]>

commit fa87f08
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 07:17:31 2024 +0100

    Update Readme.md

    Signed-off-by: Frédéric Metrich <[email protected]>

commit 884dc46
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 07:16:46 2024 +0100

    Update Readme.md

    Signed-off-by: Frédéric Metrich <[email protected]>

commit b8c948e
Author: Frédéric Metrich <[email protected]>
Date:   Thu Mar 14 07:14:47 2024 +0100

    Update Readme.md

    Signed-off-by: Frédéric Metrich <[email protected]>

commit 95a03fb
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 23:53:49 2024 +0100

    Fix parameter

commit c23a6f8
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 23:49:06 2024 +0100

    Try with define

commit e690f89
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 23:25:20 2024 +0100

    Try another option

commit f022133
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 23:07:08 2024 +0100

    Revert not working option

commit 4faaae7
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 23:03:48 2024 +0100

    Try better template parsing

commit b08d716
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:51:40 2024 +0100

    Centralize defgroups

commit b173d9a
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:40:19 2024 +0100

    Fix doxyfile

commit 10cb40e
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:31:57 2024 +0100

    Make doxygen more verbose

commit 61acc00
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:22:39 2024 +0100

    Fix doc

commit 29d72ba
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:15:47 2024 +0100

    Fix doxygen

commit e9b70c9
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:12:22 2024 +0100

    Fix doc

commit 9b1587e
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:09:02 2024 +0100

    Fix doxygen groups

commit ec70ab2
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 22:05:57 2024 +0100

    Some doc tuning

commit eef1010
Author: Frédéric Metrich <[email protected]>
Date:   Sun Mar 10 21:42:19 2024 +0100

    Some doc + TEMA

commit 5aa1365
Author: Frédéric Metrich <[email protected]>
Date:   Sat Mar 9 18:34:52 2024 +0100

    Fix ewma

commit 16e5ba4
Author: Frédéric Metrich <[email protected]>
Date:   Sat Mar 9 13:02:04 2024 +0100

    Squashed commit of the following:

    commit fb99ae1
    Author: Frédéric Metrich <[email protected]>
    Date:   Sat Mar 9 12:45:35 2024 +0100

        Add DEMA

    commit 52892c2
    Author: Frédéric Metrich <[email protected]>
    Date:   Fri Mar 8 12:42:21 2024 +0100

        Add parenthesis

    commit 843ad1c
    Merge: f817917 8ef9f7b
    Author: Frédéric Metrich <[email protected]>
    Date:   Fri Mar 8 12:41:28 2024 +0100

        Merge branch 'multi-relays' of https://github.com/FredM67/PVRouter-3-phase into multi-relays

    commit f817917
    Author: Frédéric Metrich <[email protected]>
    Date:   Fri Mar 8 12:39:40 2024 +0100

        Try DEMA

    commit 8ef9f7b
    Author: Frédéric Metrich <[email protected]>
    Date:   Thu Mar 7 21:53:34 2024 +0100

        Try double EWMA

    commit f9cfd64
    Merge: 685e204 d3bedad
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Mar 6 10:08:53 2024 +0100

        Merge branch 'multi-relays' of https://github.com/FredM67/PVRouter-3-phase into multi-relays

    commit 685e204
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Mar 6 10:08:49 2024 +0100

        Fix test

    commit d3bedad
    Author: Frédéric Metrich <[email protected]>
    Date:   Tue Mar 5 23:01:56 2024 +0100

        Some doc

    commit fcf91d3
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Feb 28 21:03:13 2024 +0100

        Fix links

    commit cdbd3e6
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Feb 28 20:59:52 2024 +0100

        Default readme to fr

    commit b334503
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Feb 28 20:39:10 2024 +0100

        Set default to no relay

    commit a8160a0
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Feb 28 15:02:38 2024 +0100

        Typo

    commit 47b9ebe
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Feb 28 14:57:37 2024 +0100

        Multi relays engine

    commit 26f896b
    Author: Frédéric Metrich <[email protected]>
    Date:   Mon Feb 26 16:12:32 2024 +0100

        Squashed commit of the following:

        commit c73c567
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Feb 26 11:11:24 2024 +0100

            Add some alias for type_trait

        commit eb53c16
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Feb 26 11:10:55 2024 +0100

            Update color in schematic

        commit eac769e
        Author: Frédéric Metrich <[email protected]>
        Date:   Thu Feb 15 21:29:47 2024 +0100

            Update Readme.md (#82)

        commit 82d84ee
        Author: Frédéric Metrich <[email protected]>
        Date:   Tue Feb 13 14:37:48 2024 +0100

            Added Thermostat_tri_HC.pdf

        commit fad5e19
        Author: Frédéric Metrich <[email protected]>
        Date:   Tue Feb 13 14:36:53 2024 +0100

            Update Thermostat_tri_HC.drawio

        commit f03b4ca
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Feb 12 11:07:04 2024 +0100

            WIP: 1772479 Fix mvAvg

        commit 5e5646a
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Feb 5 00:04:30 2024 +0100

            Update CodeQL

        commit 4684e01
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:35:01 2024 +0100

            Upt readme

        commit d957494
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:32:24 2024 +0100

            Try again

        commit 46884f3
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:30:21 2024 +0100

            Try fix

        commit c7db21e
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:28:09 2024 +0100

            Fix readme

        commit 248a89a
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:23:14 2024 +0100

            Reorganize readmes

        commit fff68e0
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:11:19 2024 +0100

            Fix branch name

        commit 656308b
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:10:39 2024 +0100

            Fix filenames

        commit b911d8d
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:08:55 2024 +0100

            Fix links

        commit 83d5591
        Author: Frédéric Metrich <[email protected]>
        Date:   Sun Feb 4 23:07:18 2024 +0100

            Multilinugal readme + more details

        commit 1772479
        Author: Frédéric Metrich <[email protected]>
        Date:   Fri Feb 2 11:39:13 2024 +0100

            Fix mvAvg

        commit 90204aa
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Jan 22 22:02:08 2024 +0100

            Fix relay template

        commit eef84ea
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Jan 22 16:36:28 2024 +0100

            Enhanced sliding average...

        commit 1ea9c53
        Author: Frédéric Metrich <[email protected]>
        Date:   Tue Nov 14 05:22:20 2023 +0100

            Reorganize folders

        commit 8522341
        Author: Frédéric Metrich <[email protected]>
        Date:   Tue Nov 14 05:20:39 2023 +0100

            Upd

        commit a6a660b
        Author: Frédéric Metrich <[email protected]>
        Date:   Wed Nov 8 23:11:58 2023 +0100

            Update Readme.md

        commit 145c86e
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Nov 6 09:13:08 2023 +0100

            Update Readme.md

        commit 4d0936b
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Nov 6 07:40:13 2023 +0100

            Update Readme.md

        commit 85910b9
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Nov 6 07:21:08 2023 +0100

            Update Readme.md

        commit efbda93
        Author: Frédéric Metrich <[email protected]>
        Date:   Mon Nov 6 07:19:52 2023 +0100

            Update Readme.md (#79)

        commit cfb0204
        Author: Frédéric Metrich <[email protected]>
        Date:   Wed Oct 4 07:58:16 2023 +0200

            Formatting

        commit e0cefcd
        Author: Frédéric Metrich <[email protected]>
        Date:   Thu Sep 21 17:29:28 2023 +0200

            Fix comment

        commit 0cf1661
        Author: Frédéric Metrich <[email protected]>
        Date:   Thu Sep 21 13:21:59 2023 +0200

            Update schema

    commit 839af94
    Author: Frédéric Metrich <[email protected]>
    Date:   Wed Sep 20 15:58:02 2023 +0200

        Move pin assignment to ctor
  • Loading branch information
FredM67 committed Jun 2, 2024
1 parent 6ba08d6 commit 1ed0344
Show file tree
Hide file tree
Showing 22 changed files with 891 additions and 544 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '>=3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install PlatformIO Core
run: |
pip install --upgrade platformio
# It is important to first install the libraries before compiling, since otherwise compilation might fail to find the just-installed libraries
- name: Install platformIO libraries
run: pio pkg install --project-dir Mk2_3phase_RFdatalog_temp
- name: Run PlatformIO
run: |
pio run --project-dir Mk2_3phase_RFdatalog_temp
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name: "CodeQL"

on:
push:
# branches: [ "main" ]
branches: [ "main" ]
paths:
- '**.ino'
- '**.cpp'
Expand All @@ -22,7 +22,7 @@ on:
- '**codeql.yml'
pull_request:
# The branches below must be a subset of the branches above
# branches: [ "main" ]
branches: [ "main" ]
paths:
- '**.ino'
- '**.cpp'
Expand Down
174 changes: 93 additions & 81 deletions Mk2_3phase_RFdatalog_temp/Readme.md

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Mk2_3phase_RFdatalog_temp/dualtariff.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class _rg_OffsetForce
{
public:
constexpr _rg_OffsetForce()
: _rg()
{
constexpr uint16_t uiPeakDurationInSec{ OffPeakDuration * 3600 };
// calculates offsets for force start and stop of each load
Expand All @@ -51,13 +50,13 @@ class _rg_OffsetForce
}
}
}
const uint32_t (&operator[](uint8_t i) const)[2]
const auto (&operator[](uint8_t i) const)
{
return _rg[i];
}

private:
uint32_t _rg[N][2];
uint32_t _rg[N][2]{};
};

inline uint32_t ul_TimeOffPeak; /**< 'timestamp' for start of off-peak period */
Expand Down
2 changes: 1 addition & 1 deletion Mk2_3phase_RFdatalog_temp/movingAvg.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class movingAvg
return _ar[idx];
}

constexpr uint8_t getSize() const
[[nodiscard]] constexpr uint8_t getSize() const
{
return DURATION_IN_MINUTES;
}
Expand Down
5 changes: 3 additions & 2 deletions Mk2_3phase_RFdatalog_temp/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ build_unflags =
extra_scripts = pre:inject_sketch_name.py
check_tool = cppcheck, clangtidy
check_flags =
cppcheck: --enable=all
clangtidy: --fix --checks=*,-llvmlibc-callee-namespace,-llvmlibc-implementation-in-namespace,-clang-diagnostic-c++17-extensions
cppcheck: --enable=all --std=c++17 --suppress=missingIncludeSystem
clangtidy: --fix --extra-arg=-std=c++17 --checks=*,-llvmlibc-callee-namespace,-llvmlibc-implementation-in-namespace,-clang-diagnostic-c++17-extensions,-llvm-header-guard
check_skip_packages = yes
check_src_filters = +<*>
monitor_filters =
default ; Remove typical terminal control codes from input
time ; Add timestamp with milliseconds for each new line
Expand Down
44 changes: 24 additions & 20 deletions Mk2_3phase_RFdatalog_temp/processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
#include "processing.h"
#include "utils_pins.h"

int32_t l_DCoffset_V[NO_OF_PHASES]; /**< <--- for LPF */

// Define operating limits for the LP filters which identify DC offset in the voltage
// sample streams. By limiting the output range, these filters always should start up
// correctly.
constexpr int32_t l_DCoffset_V_min{ (512L - 100L) * 256L }; /**< mid-point of ADC minus a working margin */
constexpr int32_t l_DCoffset_V_max{ (512L + 100L) * 256L }; /**< mid-point of ADC plus a working margin */
constexpr int16_t i_DCoffset_I_nom{ 512L }; /**< nominal mid-point value of ADC @ x1 scale */

int32_t l_DCoffset_V[NO_OF_PHASES]; /**< <--- for LPF */

constexpr uint32_t WORKING_ZONE_IN_JOULES{ 3600UL }; /**< number of joule for 1Wh */

/**< main energy bucket for 3-phase use, with units of Joules * SUPPLY_FREQUENCY */
Expand Down Expand Up @@ -182,6 +182,9 @@ void initializeOptionalPins()
}
}

#if !defined(__DOXYGEN__)
void updatePortsStates() __attribute__((optimize("-O3")));
#endif
/**
* @brief update the control ports for each of the physical loads
*
Expand Down Expand Up @@ -232,18 +235,18 @@ void updatePortsStates()
*/
void updatePhysicalLoadStates()
{
uint8_t i{ 0 };

if constexpr (PRIORITY_ROTATION != RotationModes::OFF)
{
if (b_reOrderLoads)
{
const auto temp{ loadPrioritiesAndState[0] };
for (i = 0; i < NO_OF_DUMPLOADS - 1; ++i)
uint8_t i{ NO_OF_DUMPLOADS - 1 };
do
{
loadPrioritiesAndState[i] = loadPrioritiesAndState[i + 1];
}
loadPrioritiesAndState[i] = temp;
loadPrioritiesAndState[i] = loadPrioritiesAndState[i - 1];
--i;
} while (i);
loadPrioritiesAndState[0] = temp;

b_reOrderLoads = false;
}
Expand All @@ -262,11 +265,13 @@ void updatePhysicalLoadStates()
}

const bool bDiversionOff{ b_diversionOff };
for (i = 0; i < NO_OF_DUMPLOADS; ++i)
uint8_t idx{ NO_OF_DUMPLOADS };
do
{
const auto iLoad{ loadPrioritiesAndState[i] & loadStateMask };
physicalLoadState[iLoad] = !bDiversionOff && (b_overrideLoadOn[iLoad] || (loadPrioritiesAndState[i] & loadStateOnBit)) ? LoadStates::LOAD_ON : LoadStates::LOAD_OFF;
}
--idx;
const auto iLoad{ loadPrioritiesAndState[idx] & loadStateMask };
physicalLoadState[iLoad] = !bDiversionOff && (b_overrideLoadOn[iLoad] || (loadPrioritiesAndState[idx] & loadStateOnBit)) ? LoadStates::LOAD_ON : LoadStates::LOAD_OFF;
} while (idx);
}

/**
Expand Down Expand Up @@ -334,9 +339,7 @@ void confirmPolarity(const uint8_t phase)
return;
}

++count[phase];

if (count[phase] > PERSISTENCE_FOR_POLARITY_CHANGE)
if (++count[phase] > PERSISTENCE_FOR_POLARITY_CHANGE)
{
count[phase] = 0;
polarityConfirmed[phase] = polarityOfMostRecentSampleV[phase];
Expand Down Expand Up @@ -610,8 +613,7 @@ uint8_t nextLogicalLoadToBeRemoved()
uint8_t index{ NO_OF_DUMPLOADS };
do
{
--index;
if (loadPrioritiesAndState[index] & loadStateOnBit)
if (loadPrioritiesAndState[--index] & loadStateOnBit)
{
return (index);
}
Expand Down Expand Up @@ -736,10 +738,12 @@ void processPlusHalfCycle(const uint8_t phase)
void processRawSamples(const uint8_t phase)
{
// The raw V and I samples are processed in "phase pairs"
const auto &lastPolarity{ polarityConfirmedOfLastSampleV[phase] };

if (Polarities::POSITIVE == polarityConfirmed[phase])
{
// the polarity of this sample is positive
if (Polarities::POSITIVE != polarityConfirmedOfLastSampleV[phase])
if (Polarities::POSITIVE != lastPolarity)
{
// This is the start of a new +ve half cycle, for this phase, just after the zero-crossing point.
if (beyondStartUpPeriod)
Expand All @@ -763,13 +767,13 @@ void processRawSamples(const uint8_t phase)
else
{
// the polarity of this sample is negative
if (Polarities::NEGATIVE != polarityConfirmedOfLastSampleV[phase])
if (Polarities::NEGATIVE != lastPolarity)
{
// This is the start of a new -ve half cycle (just after the zero-crossing point)
processMinusHalfCycle(phase);
}
}
} // end of processRawSamples()
}

/**
* @brief Process the current voltage raw sample for the specific phase
Expand Down
2 changes: 1 addition & 1 deletion Mk2_3phase_RFdatalog_temp/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

// ArduinoJson - https://arduinojson.org
// Copyright © 2014-2023, Benoit BLANCHON
// Copyright © 2014-2024, Benoit BLANCHON
// MIT License

#pragma once
Expand Down
6 changes: 3 additions & 3 deletions Mk2_3phase_RFdatalog_temp/type_traits/is_convertible.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ struct is_convertible
static int probe(To);
static char probe(...);

static From& _from;
static From& from_;

public:
static const bool value = sizeof(probe(_from)) == sizeof(int);
public:
static const bool value = sizeof(probe(from_)) == sizeof(int);
};
#ifdef _MSC_VER
#pragma warning(pop)
Expand Down
1 change: 0 additions & 1 deletion Mk2_3phase_RFdatalog_temp/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ inline void printConfiguration()
DBUGLN(F("is present"));

relays.printConfiguration();
relays.printConfiguration();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions Mk2_3phase_RFdatalog_temp/utils_dualtariff.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class pairForceLoad
{
}

constexpr int16_t getStartOffset() const
[[nodiscard]] constexpr int16_t getStartOffset() const
{
return iStartOffset;
}
constexpr uint16_t getDuration() const
[[nodiscard]] constexpr uint16_t getDuration() const
{
return uiDuration;
}
Expand Down
13 changes: 6 additions & 7 deletions Mk2_3phase_RFdatalog_temp/utils_relay.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "types.h"
#include "type_traits.hpp"
#include "type_traits.hpp"

#include "config_system.h"
#include "movingAvg.h"
Expand All @@ -37,7 +36,7 @@ class relayOutput
* @param _relay_pin Control pin for the relay
*/
explicit constexpr relayOutput(const uint8_t _relay_pin)
: relay_pin(_relay_pin)
: relay_pin{_relay_pin}
{
}

Expand All @@ -49,7 +48,7 @@ class relayOutput
* @param _importThreshold Import threshold to turn relay OFF
*/
constexpr relayOutput(uint8_t _relay_pin, int16_t _surplusThreshold, int16_t _importThreshold)
: relay_pin(_relay_pin), surplusThreshold(-abs(_surplusThreshold)), importThreshold(abs(_importThreshold))
: relay_pin{_relay_pin}, surplusThreshold{-abs(_surplusThreshold)}, importThreshold{abs(_importThreshold)}
{
}

Expand All @@ -63,7 +62,7 @@ class relayOutput
* @param _minOFF Minimum duration in minutes to leave relay OFF
*/
constexpr relayOutput(uint8_t _relay_pin, int16_t _surplusThreshold, int16_t _importThreshold, uint16_t _minON, uint16_t _minOFF)
: relay_pin(_relay_pin), surplusThreshold(-abs(_surplusThreshold)), importThreshold(abs(_importThreshold)), minON(_minON * 60), minOFF(_minOFF * 60)
: relay_pin{_relay_pin}, surplusThreshold{-abs(_surplusThreshold)}, importThreshold{abs(_importThreshold)}, minON{_minON * 60}, minOFF{_minOFF * 60}
{
}

Expand Down Expand Up @@ -152,7 +151,7 @@ class relayOutput
{
return try_turnON();
}
else if (currentAvgPower > importThreshold)
if (currentAvgPower > importThreshold)
{
return try_turnOFF();
}
Expand Down Expand Up @@ -256,7 +255,7 @@ class RelayEngine
* @brief Construct a list of relays
*
*/
constexpr RelayEngine(const relayOutput (&ref)[N])
explicit constexpr RelayEngine(const relayOutput (&ref)[N])
: relay(ref)
{
}
Expand Down Expand Up @@ -298,7 +297,7 @@ class RelayEngine
*/
inline static auto get_average()
{
return ewma_average.getAverageT();
return ewma_average.getAverageS();
}

/**
Expand Down
19 changes: 14 additions & 5 deletions Mk2_3phase_RFdatalog_temp/utils_temp.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ inline constexpr bool TEMP_SENSOR_PRESENT{ true }; /**< set it to 'true' if temp
inline constexpr bool TEMP_SENSOR_PRESENT{ false }; /**< set it to 'true' if temperature sensing is needed */
#endif

/**
* @struct DeviceAddress
* @brief Structure representing the address of a device.
*
* This structure is used to store the unique address of a device, such as a DS18B20 temperature sensor.
* The address is an array of 8 bytes, typically represented in hexadecimal.
*/
struct DeviceAddress
{
uint8_t addr[8]; /**< The address of the device as an array of 8 bytes. */
};

/**
* @brief This class implements the temperature sensing feature
*
Expand All @@ -35,12 +47,9 @@ class TemperatureSensing
{
using ScratchPad = uint8_t[9];

struct DeviceAddress
{
uint8_t addr[8];
};

public:
constexpr TemperatureSensing() = delete;

/**
* @brief Construct a new Temperature Sensing object
*
Expand Down
Loading

0 comments on commit 1ed0344

Please sign in to comment.