MySensors Library & Examples  2.3.2-62-ge298769
Timing.h
1 
2 /* PJON OverSampling strategy Transmission Timing table
3  Copyright 2018, Giovanni Blu Mitolo All rights reserved.
4 
5  All benchmarks are executed with NetworkAnalysis and SpeedTest examples.
6 
7  The following constants setup is quite conservative and determined only
8  with a huge amount of time testing tweaking values and analysing results.
9  Theese can be changed to obtain faster speed. Probably you will need
10  experience, time and an oscilloscope. */
11 
12 #pragma once
13 
14 /* ATmega88/168/328 - Arduino Duemilanove, Uno, Nano, Mini, Pro, Pro mini */
15 #if defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || \
16  defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
17 #if OS_MODE == 1
18 #if F_CPU == 16000000L
19 #define OS_BIT_WIDTH 512
20 #define OS_BIT_SPACER 328
21 #define OS_ACCEPTANCE 78
22 #endif
23 #endif
24 #endif
25 
26 /* ATmega1280/2560 - Arduino Mega/Mega-nano ------------------------------- */
27 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
28 #if OS_MODE == 1
29 #define OS_BIT_WIDTH 508
30 #define OS_BIT_SPACER 332
31 #define OS_ACCEPTANCE 82
32 #endif
33 #endif
34 
35 /* ATmega16/32U4 - Arduino Leonardo/Micro --------------------------------- */
36 #if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
37 #if OS_MODE == 1
38 #define OS_BIT_WIDTH 508
39 #define OS_BIT_SPACER 332
40 #define OS_ACCEPTANCE 82
41 #endif
42 #endif
43 
44 /* NodeMCU, generic ESP8266 ----------------------------------------------- */
45 #if defined(ESP8266)
46 #if OS_MODE == 1
47 #if F_CPU == 80000000L
48 #define OS_BIT_WIDTH 520
49 #define OS_BIT_SPACER 332
50 #define OS_ACCEPTANCE 82
51 #endif
52 #endif
53 #endif
54 
55 #ifndef OS_BIT_WIDTH
56 #define OS_BIT_WIDTH 512 // 520 microseconds detected by oscilloscope
57 #endif
58 
59 #ifndef OS_BIT_SPACER
60 #define OS_BIT_SPACER 328 // 340 microseconds detected by oscilloscope
61 #endif
62 
63 #ifndef OS_ACCEPTANCE
64 #define OS_ACCEPTANCE 78 // 340 microseconds detected by oscilloscope
65 #endif
66 
67 #define OS_TIMEOUT 10000 // 10 milliseconds maximum sync ack timeout
68 
69 /* Maximum initial delay in milliseconds: */
70 
71 #ifndef OS_INITIAL_DELAY
72 #define OS_INITIAL_DELAY 1000
73 #endif
74 
75 /* Maximum delay in case of collision in microseconds: */
76 
77 #ifndef OS_COLLISION_DELAY
78 #define OS_COLLISION_DELAY 64
79 #endif
80 
81 /* Maximum transmission attempts */
82 
83 #ifndef OS_MAX_ATTEMPTS
84 #define OS_MAX_ATTEMPTS 10
85 #endif
86 
87 /* Back-off exponential degree */
88 
89 #ifndef OS_BACK_OFF_DEGREE
90 #define OS_BACK_OFF_DEGREE 5
91 #endif