1-phase PV router
Loading...
Searching...
No Matches
shared_var.h
Go to the documentation of this file.
1#ifndef SHARED_VAR_H
2#define SHARED_VAR_H
3
4#include <Arduino.h>
5
6// Shared variables - carefully managed between ISR and loop
7namespace Shared
8{
9// for interaction between the main processor and the ISR
10inline volatile bool b_datalogEventPending{ false };
11inline volatile bool b_newCycle{ false };
12inline volatile bool b_overrideLoadOn[NO_OF_DUMPLOADS]{};
13inline volatile bool b_reOrderLoads{ false };
14inline volatile bool b_diversionEnabled{ true };
15
16inline volatile bool EDD_isActive{ false };
17inline volatile uint16_t absenceOfDivertedEnergyCountInSeconds{ 0 };
18
19// since there's no real locking feature for shared variables, a couple of data
20// generated from inside the ISR are copied from time to time to be passed to the
21// main processor. When the data are available, the ISR signals it to the main processor.
22inline volatile int32_t copyOf_sumP_grid_overDL_Period;
23inline volatile int32_t copyOf_sumP_diverted_overDL_Period;
24inline volatile uint16_t copyOf_divertedEnergyTotal_Wh;
25inline volatile uint16_t copyOf_divertedEnergyTotal_Wh_forDL;
26inline volatile int32_t copyOf_sum_Vsquared;
27inline volatile int32_t copyOf_energyInBucket_long;
30inline volatile uint16_t copyOf_countLoadON[NO_OF_DUMPLOADS];
31}
32
33#endif /* SHARED_VAR_H */
constexpr uint8_t NO_OF_DUMPLOADS
Definition config.h:35
volatile uint16_t copyOf_divertedEnergyTotal_Wh_forDL
Definition shared_var.h:25
volatile bool b_newCycle
Definition shared_var.h:11
volatile int32_t copyOf_energyInBucket_long
Definition shared_var.h:27
volatile int32_t copyOf_sum_Vsquared
Definition shared_var.h:26
volatile int32_t copyOf_sumP_grid_overDL_Period
Definition shared_var.h:22
volatile bool b_datalogEventPending
Definition shared_var.h:10
volatile bool b_overrideLoadOn[NO_OF_DUMPLOADS]
Definition shared_var.h:12
volatile bool b_reOrderLoads
Definition shared_var.h:13
volatile uint16_t copyOf_sampleSetsDuringThisDatalogPeriod
Definition shared_var.h:29
volatile int32_t copyOf_sumP_diverted_overDL_Period
Definition shared_var.h:23
volatile uint8_t copyOf_lowestNoOfSampleSetsPerMainsCycle
Definition shared_var.h:28
volatile uint16_t copyOf_divertedEnergyTotal_Wh
Definition shared_var.h:24
volatile uint16_t copyOf_countLoadON[NO_OF_DUMPLOADS]
Definition shared_var.h:30
volatile bool EDD_isActive
Definition shared_var.h:16
volatile uint16_t absenceOfDivertedEnergyCountInSeconds
Definition shared_var.h:17
volatile bool b_diversionEnabled
Definition shared_var.h:14