After some tests, it looks like script can't handle more than 30-35 sensors.
/**
* @file Mapping.hpp
* @author Grzegorz Krajewski
*
* Mappings.
*
* @license GPL V2
*/
#pragma once
#include <OneButton.h>
#include "../CustomSensor/CustomSensor.hpp"
namespace Relay {
const uint8_t OFF = 0;
const uint8_t ON = 1;
const uint8_t FLIP = 2;
}
const bool ActiveLow = true;
// Child ID declaration of relays
const uint8_t SALOON_1_ID = 1;
const uint8_t SALOON_2_ID = 2;
const uint8_t SALOON_3_ID = 3;
const uint8_t GAMING_ROOM_1_ID = 4;
const uint8_t GAMING_ROOM_2_ID = 5;
const uint8_t BEDROOM_ID = 6;
const uint8_t BED_1_ID = 7;
const uint8_t BED_2_ID = 8;
const uint8_t GUESTS_ID = 9;
const uint8_t BATHROOM_1_ID = 10;
const uint8_t BATHROOM_2_ID = 11;
const uint8_t MIRROR_ID = 12;
const uint8_t FAN_ID = 13;
const uint8_t KITCHEN_1_ID = 14;
const uint8_t KITCHEN_2_ID = 15;
const uint8_t KITCHEN_TABLE_ID = 16;
const uint8_t WORKSHOP_ID = 17;
const uint8_t CORRIDOR_ID = 18;
const uint8_t PUMP_ID = 19;
const uint8_t HEATING_1_ID = 20;
const uint8_t HEATING_2_ID = 21;
const uint8_t HEATING_3_ID = 22;
const uint8_t HEATING_4_ID = 23;
const uint8_t HEATING_5_ID = 24;
const uint8_t HEATING_6_ID = 25;
const uint8_t HEATING_7_ID = 26;
const uint8_t TEST_1_ID = 27;
const uint8_t TEST_2_ID = 28;
const uint8_t TEST_3_ID = 29;
const uint8_t TEST_4_ID = 30;
const uint8_t TEST_5_ID = 31;
const uint8_t TEST_6_ID = 32;
const uint8_t TEST_7_ID = 33;
const uint8_t TEST_8_ID = 34;
const uint8_t TEST_9_ID = 35;
const uint8_t TEST_10_ID = 36;
const uint8_t TEST_11_ID = 37;
const uint8_t TEST_12_ID = 38;
const uint8_t TEST_13_ID = 39;
const uint8_t TEST_14_ID = 40;
// Vector contaning child ID, description, output pin, ActiveLow as option
std::vector<CustomSensor> customSensors = std::vector<CustomSensor>() = {
{ CustomSensor(SALOON_1_ID, "Salon S1", 2) },
{ CustomSensor(SALOON_2_ID, "Salon S2", 3) },
{ CustomSensor(SALOON_3_ID, "Salon Lampka", 4) },
{ CustomSensor(GAMING_ROOM_1_ID, "Gralnia S1", 5) },
{ CustomSensor(GAMING_ROOM_2_ID, "Gralnia S2", 6) },
{ CustomSensor(BEDROOM_ID, "Sypialnia", 7) },
{ CustomSensor(BED_1_ID, "Lozko 1", 8) },
{ CustomSensor(BED_2_ID, "Lozko 2", 9) },
{ CustomSensor(GUESTS_ID, "Goscinny", 10) },
{ CustomSensor(BATHROOM_1_ID, "Lazienka", 11) },
{ CustomSensor(BATHROOM_2_ID, "Prysznic", 12) },
{ CustomSensor(MIRROR_ID, "Lustro", 13) },
{ CustomSensor(FAN_ID, "Wentylator", 14) },
{ CustomSensor(KITCHEN_1_ID, "Kuchnia", 15) },
{ CustomSensor(KITCHEN_2_ID, "Kuchnia ledy", 16) },
{ CustomSensor(KITCHEN_TABLE_ID, "Kuchnia stolik", 17) },
{ CustomSensor(WORKSHOP_ID, "Warsztat", 18) },
{ CustomSensor(CORRIDOR_ID, "Korytarz", 19) },
{ CustomSensor(PUMP_ID, "Pompa", 20) },
{ CustomSensor(HEATING_1_ID, "Strefa 1", 21) },
{ CustomSensor(HEATING_2_ID, "Strefa 2", 22) },
{ CustomSensor(HEATING_3_ID, "Strefa 3", 23) },
{ CustomSensor(HEATING_4_ID, "Strefa 4", 24) },
{ CustomSensor(HEATING_5_ID, "Strefa 5", 25) },
{ CustomSensor(HEATING_6_ID, "Strefa 6", 26) },
{ CustomSensor(HEATING_7_ID, "Strefa 7", 27) },
{ CustomSensor(TEST_1_ID, "TEST_1_ID", 28) },
{ CustomSensor(TEST_2_ID, "TEST_2_ID", 29) },
{ CustomSensor(TEST_3_ID, "TEST_3_ID", 30) },
{ CustomSensor(TEST_4_ID, "TEST_4_ID", 31) },
{ CustomSensor(TEST_5_ID, "TEST_5_ID", 32) },
{ CustomSensor(TEST_6_ID, "TEST_6_ID", 33) },
{ CustomSensor(TEST_7_ID, "TEST_7_ID", 34) },
{ CustomSensor(TEST_8_ID, "TEST_8_ID", 35) },
{ CustomSensor(TEST_9_ID, "TEST_9_ID", 36) },
{ CustomSensor(TEST_10_ID, "TEST_10_ID", 37) },
{ CustomSensor(TEST_11_ID, "TEST_11_ID", 38) },
{ CustomSensor(TEST_12_ID, "TEST_12_ID", 39) },
{ CustomSensor(TEST_13_ID, "TEST_13_ID", 40) },
{ CustomSensor(TEST_14_ID, "TEST_14_ID", 41) },
};
// Pushbuttons declaration
// Remember that names should be consistent with main loop in gateway.ino
OneButton saloon(A1, true);
OneButton gamingRoom(A2, true);
OneButton bedroom(A3, true);
OneButton bed1(A4, true);
OneButton bed2(A5, true);
OneButton guests(A6, true);
OneButton bathroom(A7, true);
OneButton mirror(A8, true);
OneButton kitchen(A9, true);
OneButton kitchenTable(A10, true);
OneButton workshop(A11, true);
OneButton corridor(A12, true);
Only change is adding couple of sensors. After that, script doesn't work (compiles without error but after change state of button, nothing happens).