forked from mysensors/MySensors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyConfig.h
1093 lines (990 loc) · 30.8 KB
/
MyConfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in RAM or EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2020 Sensnology AB
* Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
/**
* @file MyConfig.h
* @ingroup MyConfigGrp
* @brief MySensors specific configuration flags.
* @{
* Set these in your sketch before including MySensors.h to customize the library to your needs.
* If the sketch does not define these flags, they will get default values where applicable.
*/
#ifndef MyConfig_h
#define MyConfig_h
/**
* @defgroup SerialDebugGrpPub Serial and debugging
* @ingroup MyConfigGrp
* @brief These options control serial and debugging features and functionalities in the library.
* @{
*/
/**
* @def MY_DEBUG
* @brief Define MY_DEBUG to show debug prints.
*
* This option will add a lot to the size of the final sketch but is helpful to see what is actually
* is happening during development.
*
* @note Values in parenthesis indicate default values which will be used if you have not defined
* the flag in your sketch.
*/
//#define MY_DEBUG
/**
* @def MY_SPECIAL_DEBUG
* @brief Define MY_SPECIAL_DEBUG to enable support for I_DEBUG messages.
*
* I_DEBUG messages are sent from the controller to the node, which responds with the requested
* data. The request can be one of the following:
* - 'R': routing info (only repeaters): received msg XXYY (as stream), where XX is the node and YY
* the routing node
* - 'V': CPU voltage
* - 'F': CPU frequency
* - 'M': free memory
* - 'E': clear MySensors EEPROM area and reboot (i.e. "factory" reset)
*/
//#define MY_SPECIAL_DEBUG
/**
* @def MY_DISABLED_SERIAL
* @brief Define MY_DISABLED_SERIAL if you want to use the UART TX/RX pins as normal I/O pins.
*
* @note When defined, if you want to use the pins as a UART, you need to handle initialization and
* configuration yourself.
*/
//#define MY_DISABLED_SERIAL
/**
* @def MY_SPLASH_SCREEN_DISABLED
* @ingroup memorysavings
* @brief If defined, will disable the MySensors splash screen.
*
* @note This saves 120 bytes of flash.
*/
//#define MY_SPLASH_SCREEN_DISABLED
/**
* @def MY_BAUD_RATE
* @brief Serial output baud rate (debug prints and serial gateway speed).
*
* The baud rate configured here must match the baud rate at the "other" end.
*
* @warning Depending on your target device and clock speed, certain baud rates might not work well.
*/
#ifndef MY_BAUD_RATE
#define MY_BAUD_RATE (115200ul)
#endif
/**
* @def MY_SERIAL_OUTPUT_SIZE
* @brief Maximum characters for serial output.
*
* If you are running extremely low on memory, reducing this size might just save your day.
*/
#ifndef MY_SERIAL_OUTPUT_SIZE
#define MY_SERIAL_OUTPUT_SIZE (120u)
#endif
/** @}*/ // End of SerialDebugGrpPub group
/**
* @def MY_DEBUG_VERBOSE_OTA_UPDATE
* @brief Define this for verbose debug prints related to FOTA updates.
*/
//#define MY_DEBUG_VERBOSE_OTA_UPDATE
/**
* @defgroup TransportSettingGrpPub Transport selection
* @ingroup MyConfigGrp
* @brief These options control what transport type to use and various transport specific customisations.
* @{
*/
/**
* @defgroup RS485SettingGrpPub RS485
* @ingroup TransportSettingGrpPub
* @brief These options are specific to the RS485 wired transport.
* @{
*/
/**
* @def MY_RS485
* @brief Define this to use the RS485 wired transport for sensor network communication.
*/
//#define MY_RS485
/**
* @def MY_CAN
* @brief Define this to use the CAN wired transport for sensor network communication.
*/
//#define MY_CAN
/**
* @def MY_DEBUG_VERBOSE_CAN
* @brief Define this for verbose debug prints related to the %CAN driver.
*/
//#define MY_DEBUG_VERBOSE_CAN
/**
* @def CAN_INT
* @brief Message arrived interrupt pin.
*/
#ifndef CAN_INT
#define CAN_INT (9u)
#endif
/**
* @def CAN_CS
* @brief Chip select pin.
*/
#ifndef CAN_CS
#define CAN_CS (10u)
#endif
/**
* @def CAN_SPEED
* @brief Baud rate. Allowed values can be found in mcp_can_dfs.h
*/
#ifndef CAN_SPEED
#define CAN_SPEED CAN_50KBPS
#endif
/**
* @def CAN_CLOCK
* @brief can clock. Allowed values can be found in mcp_can_dfs.h
*/
#ifndef CAN_CLOCK
#define CAN_CLOCK MCP_16MHZ
#endif
/**
* @def CAN_BUF_SIZE
* @brief assemble buffer size. Since long messages can be sliced and arrive mixed with other messages, assemble buffer is required.
*/
#ifndef CAN_BUF_SIZE
#define CAN_BUF_SIZE (8u)
#endif
/**
* @def MY_RS485_BAUD_RATE
* @brief The RS485 BAUD rate.
*/
#ifndef MY_RS485_BAUD_RATE
#define MY_RS485_BAUD_RATE (9600)
#endif
/**
* @def MY_RS485_MAX_MESSAGE_LENGTH
* @brief The maximum message length used for RS485.
*/
#ifndef MY_RS485_MAX_MESSAGE_LENGTH
#define MY_RS485_MAX_MESSAGE_LENGTH (40)
#endif
/**
* @def MY_RS485_SOH_COUNT
* @brief Use this in case of collisions on the bus. 3 might be a good setting.
*/
#ifndef MY_RS485_SOH_COUNT
#define MY_RS485_SOH_COUNT (1)
#endif
/**
* @def MY_RS485_DE_PIN
* @brief RS485 driver enable pin.
*/
//#define MY_RS485_DE_PIN (2)
/**
* @def MY_RS485_DE_INVERSE
* @brief Define this if RS485 driver enable pin polarity is inverted (low-active).
*/
//#define MY_RS485_DE_INVERSE
/**
* @def MY_RS485_HWSERIAL
* @brief Define this if RS485 is connected to a hardware serial port.
*
* Example: @code #define MY_RS485_HWSERIAL Serial1 @endcode
*/
//#define MY_RS485_HWSERIAL (Serial1)
/** @}*/ // End of RS485SettingGrpPub group
/**
* @defgroup SoftSpiSettingGrpPub Soft SPI
* @ingroup TransportSettingGrpPub
* @brief These options are specific the soft SPI driver for certain radio transport drivers.
*
* The following transport drivers supported by this driver:
* - The RF24 driver @see RF24SettingGrpPub
* - The new %RFM69 driver @see RFM69SettingGrpPub @see MY_RFM69_NEW_DRIVER
* - The RFM95 driver @see RFM95SettingGrpPub
* @{
*/
/**
* @def MY_SOFTSPI
* @brief Define this to use a software based SPI driver which allows more freedom in pin selection
* for the (supported) radio module.
*/
//#define MY_SOFTSPI
/**
* @def MY_SOFT_SPI_SCK_PIN
* @brief Soft SPI SCK pin.
*/
#ifndef MY_SOFT_SPI_SCK_PIN
#define MY_SOFT_SPI_SCK_PIN (14)
#endif
/**
* @def MY_SOFT_SPI_MISO_PIN
* @brief Soft SPI MISO pin.
*/
#ifndef MY_SOFT_SPI_MISO_PIN
#define MY_SOFT_SPI_MISO_PIN (16)
#endif
/**
* @def MY_SOFT_SPI_MOSI_PIN
* @brief Soft SPI MOSI pin.
*/
#ifndef MY_SOFT_SPI_MOSI_PIN
#define MY_SOFT_SPI_MOSI_PIN (15)
#endif
/** @}*/ // End of SoftSpiSettingGrpPub group
/** @}*/ // End of TransportSettingGrpPub group
/**
* @defgroup RoutingNodeSettingGrpPub Routing and node
* @ingroup MyConfigGrp
* @brief These options control message routing and node configurations.
* @{
*/
/**
* @def MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
* @ingroup memorysavings
* @brief If defined, routing table will not be kept in RAM.
* @see MY_RAM_ROUTING_TABLE_FEATURE
*/
/**
* @def MY_RAM_ROUTING_TABLE_FEATURE
* @brief If enabled, the routing table is kept in RAM (if memory allows) and saved in regular
* intervals.
* @note Enabled by default on most platforms, but on AVR only for atmega1280, atmega1284 and
* atmega2560.
* @see MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
*/
#ifndef MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
#define MY_RAM_ROUTING_TABLE_FEATURE
#endif
/**
* @def MY_ROUTING_TABLE_SAVE_INTERVAL_MS
* @brief Interval to dump content of routing table to EEPROM
*/
#ifndef MY_ROUTING_TABLE_SAVE_INTERVAL_MS
#define MY_ROUTING_TABLE_SAVE_INTERVAL_MS (30*60*1000ul)
#endif
/**
* @def MY_PARENT_NODE_ID
* @brief Node parent defaults to AUTO (tries to find a parent automatically).
*/
#ifndef MY_PARENT_NODE_ID
#define MY_PARENT_NODE_ID 0
#endif
/**
* @def MY_PARENT_NODE_IS_STATIC
* @brief Define MY_PARENT_NODE_IS_STATIC to disable fall back if parent node fails
*/
#define MY_PARENT_NODE_IS_STATIC
/**
* @def MY_TRANSPORT_SANITY_CHECK
* @brief If defined, will cause node to check transport in regular intervals to detect HW issues
* and re-initialize in case of failure.
* @note This feature is enabled for all repeater nodes (incl. GW)
*/
//#define MY_TRANSPORT_SANITY_CHECK
/**
* @def MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS
* @brief Interval (in ms) for transport sanity checks
*/
#ifndef MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS
#define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS (15*60*1000ul)
#endif
/**
* @def MY_TRANSPORT_DISCOVERY_INTERVAL_MS
* @brief This is a gateway-only feature: Interval (in ms) to issue network discovery checks
*/
#ifndef MY_TRANSPORT_DISCOVERY_INTERVAL_MS
#define MY_TRANSPORT_DISCOVERY_INTERVAL_MS (20*60*1000ul)
#endif
/**
*@def MY_TRANSPORT_UPLINK_CHECK_DISABLED
*@brief If defined, disables uplink check to GW during transport initialisation
*/
#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
/**
*@def MY_TRANSPORT_MAX_TX_FAILURES
*@brief Define to override max. consecutive TX failures until SNP is initiated
*/
//#define MY_TRANSPORT_MAX_TX_FAILURES (10u)
/**
* @def MY_TRANSPORT_WAIT_READY_MS
* @brief Timeout in ms until transport is ready during startup, set to 0 for no timeout
*/
#ifndef MY_TRANSPORT_WAIT_READY_MS
#define MY_TRANSPORT_WAIT_READY_MS (0)
#endif
/**
* @def MY_SIGNAL_REPORT_ENABLED
* @brief Enables signal report functionality.
* @note This feature adds ~1kB code to the sketch.
*/
//#define MY_SIGNAL_REPORT_ENABLED
/** @}*/ // End of RoutingNodeSettingGrpPub group
/**
* @defgroup RegistrationSettingGrpPub Node registration
* @ingroup MyConfigGrp
* @brief These options control node registration configurations.
* @{
*/
/**
* @def MY_REGISTRATION_FEATURE
* @brief If enabled, node has to register to GW/controller before being allowed to send sensor
* data.
* @note Enabled by default.
*/
//#define MY_REGISTRATION_FEATURE
/**
* @def MY_REGISTRATION_RETRIES
* @brief Number of registration retries if no reply received from GW/controller.
*/
#ifndef MY_REGISTRATION_RETRIES
#define MY_REGISTRATION_RETRIES (3u)
#endif
/**
* @def MY_REGISTRATION_DEFAULT
* @brief Node registration default - this applies if no registration response is received from
* controller.
*/
#define MY_REGISTRATION_DEFAULT (true)
/**
* @def MY_REGISTRATION_CONTROLLER
* @brief If defined, node registration request has to be handled by controller
*/
//#define MY_REGISTRATION_CONTROLLER
/** @}*/ // End of RegistrationSettingGrpPub group
/**
* @defgroup CoreSettingGrpPub Core
* @ingroup MyConfigGrp
* @brief These options control the library core configurations.
* @{
*/
/**
* @def MY_CORE_ONLY
* @brief Define this if you want to use core functions without loading the framework.
*/
//#define MY_CORE_ONLY
/**
* @def MY_CORE_COMPATIBILITY_CHECK
* @brief If defined, library compatibility is checked during node registration.
* Incompatible libraries are unable to send sensor data.
*/
#define MY_CORE_COMPATIBILITY_CHECK
/** @}*/ // End of CoreSettingGrpPub group
/**
* @defgroup SleepSettingGrpPub Sleep
* @ingroup MyConfigGrp
* @brief These options control sleep configurations.
* @{
*/
/**
* @def MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS
* @brief Timeout (in ms) to re-establish link if node is send to sleep and transport is not ready.
*/
#ifndef MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS
#define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS (10*1000ul)
#endif
/**
* @def MY_SMART_SLEEP_WAIT_DURATION_MS
* @brief The wait period (in ms) before going to sleep when using smartSleep-functions.
*
* This period has to be long enough for controller to be able to send out
* potential buffered messages.
*/
#ifndef MY_SMART_SLEEP_WAIT_DURATION_MS
#define MY_SMART_SLEEP_WAIT_DURATION_MS (500ul)
#endif
/**
* @def MY_SLEEP_HANDLER
* @brief Define this to enable the custom pre- & post-sleep handler.
*
* Sleep handler is invoked right before entering the sleep function, as well a just after the sleep
* completes. Applications can use this handler to turn off peripherals or put pins into a best
* possible low power state according to the concrete hardware design.
*/
//#define MY_SLEEP_HANDLER
/** @}*/ // End of SleepSettingGrpPub group
/**
* @def MY_DISABLE_REMOTE_RESET
* @brief Disables over-the-air reset of node
*/
//#define MY_DISABLE_REMOTE_RESET
/** @}*/ // End of OTASettingGrpPub group
/**
* @defgroup GatewaySettingGrpPub Gateway
* @ingroup MyConfigGrp
* @brief These options control gateway specific configurations.
* @{
*/
/**
* @def MY_GATEWAY_MAX_RECEIVE_LENGTH
* @brief Max buffersize needed for messages coming from controller.
*/
#ifndef MY_GATEWAY_MAX_RECEIVE_LENGTH
#define MY_GATEWAY_MAX_RECEIVE_LENGTH (100u)
#endif
/**
* @def MY_GATEWAY_MAX_SEND_LENGTH
* @brief Max buffer size when sending messages.
*/
#ifndef MY_GATEWAY_MAX_SEND_LENGTH
#define MY_GATEWAY_MAX_SEND_LENGTH (120u)
#endif
/**
* @def MY_GATEWAY_MAX_CLIENTS
* @brief Max number of parallel clients (sever mode).
*/
#ifndef MY_GATEWAY_MAX_CLIENTS
#define MY_GATEWAY_MAX_CLIENTS (1u)
#endif
/**************************************
* Ethernet Gateway Transport Defaults
***************************************/
/**
* @def MY_GATEWAY_SERIAL
* @brief Define this for Serial GW.
*/
// The gateway options available
//#define MY_GATEWAY_SERIAL
/**
* @def MY_DEBUG_VERBOSE_GATEWAY
* @brief Define this for verbose debug prints related to the gateway transport.
*/
//#define MY_DEBUG_VERBOSE_GATEWAY
/**
* @defgroup LEDSettingGrpPub LED
* @ingroup MyConfigGrp
* @brief These options control LED specific configurations.
* @{
*/
/**
* @def MY_DEFAULT_ERR_LED_PIN
* @brief Define this with a value that correspond to your placement of the error indication LED.
*
* @note This is optional.
* @note On some platforms (for example sensebender GW) the hardware definitions can enable the LED
* by default. That default can be overridden by defining this flag.
*/
//#define MY_DEFAULT_ERR_LED_PIN (6)
/**
* @def MY_DEFAULT_TX_LED_PIN
* @brief Define this with a value that correspond to your placement of the TX indication LED.
*
* @note This is optional.
* @note On some platforms (for example sensebender GW) the hardware definitions can enable the LED
* by default. That default can be overridden by defining this flag.
*/
//#define MY_DEFAULT_TX_LED_PIN (7)
/**
* @def MY_DEFAULT_RX_LED_PIN
* @brief Define this with a value that correspond to your placement of the RX indication LED.
*
* @note This is optional.
* @note On some platforms (for example sensebender GW) the hardware definitions can enable the LED
* by default. That default can be overridden by defining this flag.
*/
//#define MY_DEFAULT_RX_LED_PIN (8)
/**
* @def MY_WITH_LEDS_BLINKING_INVERSE
* @brief Define this to inverse the LED blinking.
*
* When defined LEDs are normally turned on and switches off when blinking.
*/
//#define MY_WITH_LEDS_BLINKING_INVERSE
/**
* @def MY_INDICATION_HANDLER
* @brief Define to use own indication handler.
*/
//#define MY_INDICATION_HANDLER
/**
* @def MY_DEFAULT_LED_BLINK_PERIOD
* @brief Default LEDs blinking period in milliseconds.
*/
#ifndef MY_DEFAULT_LED_BLINK_PERIOD
#define MY_DEFAULT_LED_BLINK_PERIOD 300
#endif
/** @}*/ // End of LEDSettingGrpPub group
/**
* @defgroup SigningSettingGrpPub Signing
* @ingroup SecuritySettingGrpPub
* @brief These options control signing related configurations.
*
* @see MySigninggrpPub
* @{
*/
/**
* @def MY_DEBUG_VERBOSE_SIGNING
* @brief Define this for verbose debug prints related to signing.
*/
//#define MY_DEBUG_VERBOSE_SIGNING
/**
* @def MY_SIGNING_SIMPLE_PASSWD
* @brief Enables SW backed signing functionality in library and uses provided password as key.
*
* This flag is automatically set if @ref MY_SECURITY_SIMPLE_PASSWD is used.
*
* This flag will enable signing and signature requests. It has to be identical on ALL nodes in the
* network.
*
* Whitelisting is supported and serial will be the first 8 characters of the password, the ninth
* character will be the node ID (to make each node have a unique serial).
*
* As with the regular signing modes, whitelisting is only activated if a whitelist is specified in
* the sketch.
*
* No @ref personalization is required for this mode.
*
* It is allowed to set @ref MY_SIGNING_WEAK_SECURITY for deployment purposes in this mode as it is
* with the regular software and ATSHA204A based modes.
*
* If the provided password is shorter than the size of the HMAC key, it will be null-padded
* to accommodate the key size in question. A 32 character password is the maximum length. Any
* password longer than that will be truncated.
*
* Example: @code #define MY_SIGNING_SIMPLE_PASSWD "MyInsecurePassword" @endcode
*
* @see MY_SECURITY_SIMPLE_PASSWD
*
*/
//#define MY_SIGNING_SIMPLE_PASSWD "MyInsecurePassword"
#if defined(MY_SIGNING_SIMPLE_PASSWD)
#define MY_SIGNING_SOFT
#define MY_SIGNING_REQUEST_SIGNATURES
#endif
/**
* @def MY_SIGNING_ATSHA204
* @brief Enables HW backed signing functionality in library.
*/
//#define MY_SIGNING_ATSHA204
/**
* @def MY_SIGNING_SOFT
* @brief Enables SW backed signing functionality in library.
*/
//#define MY_SIGNING_SOFT
/**
* @def MY_SIGNING_REQUEST_SIGNATURES
* @brief Enable this to inform gateway to sign all messages sent to this node.
*
* If used for a gateway, gateway will by default require signatures from ALL nodes. This behavior
* can be disabled by weakening security.
* @see MY_SIGNING_WEAK_SECURITY
*/
//#define MY_SIGNING_REQUEST_SIGNATURES
/**
* @def MY_SIGNING_WEAK_SECURITY
* @brief Enable this to permit downgrade of security preferences and relaxed gateway signing
* requirements.
*
* Use this for evaluating security. It allows for gradual introduction of signing requirements in
* a network. Nodes that present themselves as not requiring signing or whitelisting will be
* cleared of this requirement at the receiving end. A gateway which require signatures will only do
* so from nodes that in turn require signatures.
*
* When not set, any node that has presented themselves as a node that require signatures or
* whitelisting, will be permanently remembered as doing so at the receiver until EEPROM is cleared
* or the receiver is reconfigured with this flag set or has signing disabled alltogether.
*
* @warning This flag when set will weaken security significantly
*/
//#define MY_SIGNING_WEAK_SECURITY
/**
* @def MY_VERIFICATION_TIMEOUT_MS
* @brief Define a suitable timeout for a signature verification session
*
* Consider the turnaround from a nonce being generated to a signed message being received
* which might vary, especially in networks with many hops.
*
* Shorter time gives less time for an attacker to figure a way to hijack the nonce and attempt to
* brute force attack the node. Longer time permits more network hops and node or GW processing
* time. 5s ought to be enough for anyone.
*/
#ifndef MY_VERIFICATION_TIMEOUT_MS
#define MY_VERIFICATION_TIMEOUT_MS (5*1000ul)
#endif
/**
* @def MY_LOCK_DEVICE
* @brief Enable read back protection
*
* Enable read back protection feature. Currently only supported by NRF51+NRF52.
* Use this flag to protect signing and encryption keys stored in the MCU.
*
* Set this flag, when you use softsigning in MySensors. Don't set this
* in SecurityPersonalizer.
*
* @warning YOU CAN BRICK YOUR DEVICE!!!
* Don't set this flag without having an boot loader, OTA firmware update and
* an Gateway connection. To reset an device, you can try >>
* openocd -f interface/cmsis-dap.cfg -f target/nrf52.cfg -c "program dap apreg 1 0x04 0x01"
*/
//#define MY_LOCK_DEVICE
//#define MY_NODE_LOCK_FEATURE
/**
* @def MY_NODE_UNLOCK_PIN
* @brief By grounding this pin during reset of a locked node, the node will unlock.
*
* If using a secure bootloader, grounding the pin is the only option to reactivate the node.
* If using stock Android bootloader or a DualOptiBoot it is also possible to download a sketch
* using serial protocol to erase EEPROM to unlock the node.
*/
#ifndef MY_NODE_UNLOCK_PIN
#define MY_NODE_UNLOCK_PIN (14)
#endif
/**
* @def MY_NODE_LOCK_COUNTER_MAX
* @brief Maximum accepted occurrences of suspected malicious activity in a node.
*
* Counter decrements on reoccurring incidents but resets if legitimate behaviour is identified.
*/
#ifndef MY_NODE_LOCK_COUNTER_MAX
#define MY_NODE_LOCK_COUNTER_MAX (5)
#endif
/** @}*/ // Node lock group
/** @}*/ // End of SecuritySettingGrpPub group
/**
* @defgroup PlatformSettingGrpPub Platform specifics
* @ingroup MyConfigGrp
* @brief These options control platform specific configurations.
* @{
*/
/**
* @defgroup ESP8266SettingGrpPub ESP8266
* @ingroup PlatformSettingGrpPub
* @brief These options control ESP8266 specific configurations.
* @{
*/
/**
* @def MY_ESP8266_SERIAL_MODE
* @brief ESP8266 serial modes
*
* - SERIAL_FULL: Default mode.
* - SERIAL_TX_ONLY: allows to use RX (GPIO3) as a general purpose input/output.
* - SERIAL_RX_ONLY: allows to use TX (GPIO1) as a general purpose input/output.
*/
#ifndef MY_ESP8266_SERIAL_MODE
#define MY_ESP8266_SERIAL_MODE SERIAL_FULL
#endif
/** @}*/ // End of ESP8266SettingGrpPub group
/**
* @defgroup ESP32SettingGrpPub ESP32
* @ingroup PlatformSettingGrpPub
* @brief These options control ESP32 specific configurations.
* @{
*/
//
// no ESP32 settings
//
/** @}*/ // End of ESP32SettingGrpPub group
/**
* @defgroup LinuxSettingGrpPub Linux
* @ingroup PlatformSettingGrpPub
* @brief These options control Linux specific configurations.
* @{
*/
/**
* @def MY_LINUX_SERIAL_PORT
* @brief Serial device port
*/
//#define MY_LINUX_SERIAL_PORT "/dev/ttyUSB0"
/**
* @def MY_LINUX_SERIAL_PTY
* @brief deprecated option
*/
#ifdef MY_LINUX_SERIAL_PTY
#warning MY_LINUX_SERIAL_PTY is deprecated, please use MY_LINUX_SERIAL_PORT
#define MY_LINUX_SERIAL_PORT MY_LINUX_SERIAL_PTY
#endif
/**
* @def MY_LINUX_IS_SERIAL_PTY
* @brief deprecated option
*/
#ifdef MY_LINUX_IS_SERIAL_PTY
#warning MY_LINUX_IS_SERIAL_PTY is deprecated, please use MY_LINUX_SERIAL_IS_PTY
#define MY_LINUX_SERIAL_IS_PTY
#endif
/**
* @def MY_LINUX_SERIAL_IS_PTY
* @brief Set serial as a pseudo terminal.
*
* Enable this if you need to connect to a controller running on the same device.
* You also need to define MY_LINUX_SERIAL_PORT with the symlink name for the PTY device.
*/
//#define MY_LINUX_SERIAL_IS_PTY
/**
* @def MY_LINUX_SERIAL_GROUPNAME
* @brief Grant access to the specified system group for the serial device.
*/
//#define MY_LINUX_SERIAL_GROUPNAME "tty"
/**
* @def MY_LINUX_CONFIG_FILE
* @brief Sets the filepath for the gateway config file.
*
* @note For now the configuration file is only used to store the emulated eeprom state.
*/
#ifndef MY_LINUX_CONFIG_FILE
#define MY_LINUX_CONFIG_FILE "/etc/mysensors.conf"
#endif
/** @}*/ // End of LinuxSettingGrpPub group
/** @}*/ // End of PlatformSettingGrpPub group
/*
* "Helper" definitions
*/
/*
* Detect node type
* MY_GATEWAY_FEATURE is set for gateway sketches.
* MY_IS_GATEWAY is true when @ref MY_GATEWAY_FEATURE is set.
* MY_NODE_TYPE contain a string describing the class of sketch/node (gateway/repeater/node).
*/
#if defined(MY_GATEWAY_SERIAL) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_ENC28J60) || defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP32)|| defined(MY_GATEWAY_LINUX) || defined(MY_GATEWAY_MQTT_CLIENT) || defined(MY_GATEWAY_TINYGSM)
#define MY_GATEWAY_FEATURE
#define MY_IS_GATEWAY (true)
#define MY_NODE_TYPE "GW"
#else
#define MY_IS_GATEWAY (false)
#define MY_NODE_TYPE "NODE"
#endif
// DEBUG
#if defined(MY_DISABLED_SERIAL) && !defined(MY_DEBUG_OTA)
#undef MY_DEBUG
#endif
#if defined(MY_DEBUG)
// standard debug output
#define MY_DEBUG_VERBOSE_CORE //!< MY_DEBUG_VERBOSE_CORE
#define MY_DEBUG_VERBOSE_TRANSPORT //!< MY_DEBUG_VERBOSE_TRANSPORT
#define MY_DEBUG_VERBOSE_GATEWAY //!< MY_DEBUG_VERBOSE_GATEWAY
#define MY_DEBUG_VERBOSE_OTA_UPDATE //!< MY_DEBUG_VERBOSE_OTA_UPDATE
#endif
#if defined(MY_DEBUG) || defined(MY_DEBUG_VERBOSE_CORE) || defined(MY_DEBUG_VERBOSE_TRANSPORT) || defined(MY_DEBUG_VERBOSE_GATEWAY) || defined(MY_DEBUG_VERBOSE_SIGNING) || defined(MY_DEBUG_VERBOSE_OTA_UPDATE) || defined(MY_DEBUG_VERBOSE_RF24) || defined(MY_DEBUG_VERBOSE_NRF5_ESB) || defined(MY_DEBUG_VERBOSE_RFM69) || defined(MY_DEBUG_VERBOSE_RFM95) || defined(MY_DEBUG_VERBOSE_TRANSPORT_HAL)
#define DEBUG_OUTPUT_ENABLED //!< DEBUG_OUTPUT_ENABLED
#ifndef MY_DEBUG_OTA
#define DEBUG_OUTPUT(x,...) hwDebugPrint(x, ##__VA_ARGS__) //!< debug
#else
#ifndef MY_OTA_LOG_SENDER_FEATURE
#define MY_OTA_LOG_SENDER_FEATURE
#endif
#ifndef MY_DEBUG_OTA_DISABLE_ECHO
#define DEBUG_OUTPUT(x,...) OTALog((MY_DEBUG_OTA), true, x, ##__VA_ARGS__) //!< debug
#else
#define DEBUG_OUTPUT(x,...) OTALog((MY_DEBUG_OTA), false, x, ##__VA_ARGS__) //!< debug
#endif
// disable radio related debugging messages
#undef MY_DEBUG_VERBOSE_RF24
#undef MY_DEBUG_VERBOSE_NRF5_ESB
#undef MY_DEBUG_VERBOSE_RFM69
#undef MY_DEBUG_VERBOSE_RFM69_REGISTERS
#undef MY_DEBUG_VERBOSE_RFM95
#endif
#else
#define DEBUG_OUTPUT(x,...) //!< debug NULL
#endif
// temp. workaround for nRF5 verifier: redirect RF24 to NRF_ESB
#if defined(ARDUINO_ARCH_NRF5) && (defined(MY_RADIO_RF24) )
#undef MY_RADIO_RF24
#define MY_RADIO_NRF5_ESB
#endif
// Enable sensor network "feature" if one of the transport types was enabled
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485) || defined(MY_PJON) || defined(MY_CAN)
#define MY_SENSOR_NETWORK
#endif
// LEDS
#if !defined(MY_DEFAULT_ERR_LED_PIN) && defined(MY_HW_ERR_LED_PIN)
#define MY_DEFAULT_ERR_LED_PIN MY_HW_ERR_LED_PIN
#endif
#if !defined(MY_DEFAULT_TX_LED_PIN) && defined(MY_HW_TX_LED_PIN)
#define MY_DEFAULT_TX_LED_PIN MY_HW_TX_LED_PIN
#endif
#if !defined(MY_DEFAULT_RX_LED_PIN) && defined(MY_HW_TX_LED_PIN)
#define MY_DEFAULT_RX_LED_PIN MY_HW_TX_LED_PIN
#endif
#endif // MyConfig_h
// Doxygen specific constructs, not included when built normally
// This is used to enable disabled macros/definitions to be included in the documentation as well.
#if DOXYGEN
/**
* @def ARDUINO_ARCH_SAMD
* @brief Automatically set when building for SAMD targets
*/
#define ARDUINO_ARCH_SAMD
/**
* @def ARDUINO_ARCH_NRF5
* @brief Automatically set when building for nRF5 targets
*/
#define ARDUINO_ARCH_NRF5
/**
* @def ARDUINO_ARCH_ESP8266
* @brief Automatically set when building for ESP8266 targets
*/
#define ARDUINO_ARCH_ESP8266
/**
* @def ARDUINO_ARCH_ESP32
* @brief Automatically set when building for ESP32 targets
*/
#define ARDUINO_ARCH_ESP32
/**
* @def ARDUINO_ARCH_AVR
* @brief Automatically set when building for AVR targets
*/
#define ARDUINO_ARCH_AVR
/**
* @def ARDUINO_ARCH_STM32F1
* @brief Automatically set when building for STM32F1 targets
*/
#define ARDUINO_ARCH_STM32F1
/**
* @def TEENSYDUINO
* @brief Automatically set when building for Teensy targets
*/
#define TEENSYDUINO
// debug
#define MY_DEBUG
#define MY_DEBUGDEVICE
#define MY_DEBUG_OTA
#define MY_DEBUG_OTA_DISABLE_ECHO
#define MY_SPECIAL_DEBUG
#define MY_DISABLED_SERIAL
#define MY_SPLASH_SCREEN_DISABLED
// linux
#define MY_LINUX_SERIAL_PORT
#define MY_LINUX_SERIAL_IS_PTY
#define MY_LINUX_SERIAL_GROUPNAME
#define MY_LINUX_SERIAL_PTY
#define MY_LINUX_IS_SERIAL_PTY
// inclusion mode
#define MY_INCLUSION_MODE_FEATURE
#define MY_INCLUSION_BUTTON_FEATURE
// OTA logging and debug
#define MY_OTA_LOG_RECEIVER_FEATURE
#define MY_OTA_LOG_SENDER_FEATURE
// transport
#define MY_PARENT_NODE_IS_STATIC
#define MY_REGISTRATION_CONTROLLER
#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
#define MY_TRANSPORT_SANITY_CHECK
#define MY_NODE_LOCK_FEATURE
#define MY_REPEATER_FEATURE
#define MY_PASSIVE_NODE
#define MY_MQTT_CLIENT_PUBLISH_RETAIN
#define MY_MQTT_PASSWORD
#define MY_MQTT_USER
#define MY_MQTT_CLIENT_ID
#define MY_MQTT_PUBLISH_TOPIC_PREFIX
#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX
#define MY_MQTT_CA_CERT
#define MY_MQTT_CLIENT_CERT
#define MY_MQTT_CLIENT_KEY
#define MY_SIGNAL_REPORT_ENABLED
// general
#define MY_WITH_LEDS_BLINKING_INVERSE
#define MY_INDICATION_HANDLER
#define MY_DISABLE_REMOTE_RESET
#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
#define MY_LOCK_DEVICE
#define MY_SLEEP_HANDLER
// core
#define MY_CORE_ONLY
// GW
#define MY_DEBUG_VERBOSE_GATEWAY
#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
#define MY_INCLUSION_LED_PIN
#define MY_GATEWAY_W5100
#define MY_GATEWAY_ENC28J60
#define MY_GATEWAY_ESP8266
#define MY_GATEWAY_ESP32