Lydia - Printhead
config_adv.h
Go to the documentation of this file.
1 #ifndef CONFIG_ADV_H
2 #define CONFIG_ADV_H
3 
5 //
6 // Modbus
7 
8 #define MODBUS_CMD_WAIT 20 // Minimum time to wait for a response
9 #define MODBUS_R_RETRY 2 // max read queries
10 #define MODBUS_W_RETRY 4 // max write queries
11 #define MODBUS_MAX_LIFESPAN SECS * 3 // Maximal lifespan of a query
12 
13 // Maximal number of queries in the buffer (recommended : 3x the number of devices)
14 #define MAX_QUERY_BUFFER 10
15 
16 // Status poll priority
17 #define MB_QUERY_TYPE_STATUS_POLL 10
18 // Status poll priority high
19 #define MB_QUERY_TYPE_STATUS_POLL_2 50
20  // Command priority
21 #define MB_QUERY_TYPE_CMD 100
22 
23 // As per specification, Modbus max. registers are 125
24 #define MODBUS_TCP_MAX_REGISTERS 125
25 // Mudbus default register value for read registers
26 #define MODBUS_TCP_DEFAULT_REGISTER_VALUE 0
27 
28 // For devices timing out, increase the retry interval to max 10 seconds
29 #define MB_MAX_POLL_INTERVAL SECS * 10
30 // For devices timing out, increase the next read interval by this
31 #define MB_POLL_RETRY_STEP SECS * 1
32 
34 //
35 // Power settings
36 
37 // optional current sensor to validate primary power is there
38 // #define POWER_CSENSOR_PRIMARY CONTROLLINO_A15
39 
40 // optional current sensor to validate primary power is there
41 // #define POWER_CSENSOR_SECONDARY CONTROLLINO_A14
42 
44 //
45 // Motor load settings, this requires a current sensor or can be
46 // taken from the VFD's output.
47 
48 // the interval to read the current
49 #define MOTOR_LOAD_READ_INTERVAL 100
50 
51 // the current measured when the motor runs idle, min - max range
52 #define MOTOR_IDLE_LOAD_RANGE_MIN 5
53 #define MOTOR_IDLE_LOAD_RANGE_MAX 20
54 
55 // the current measured when the motor is under load, min - max range
56 #define MOTOR_LOAD_RANGE_MIN 20
57 #define MOTOR_LOAD_RANGE_MAX 60
58 
59 // the current measured when the motor is overloaded, min - max range
60 #define MOTOR_OVERLOAD_RANGE_MIN 80
61 #define MOTOR_OVERLOAD_RANGE_MAX 800
62 
63 // #define MOTOR_MIN_DT 2500
64 
66 //
67 // Error codes
68 //
69 #define E_MSG_OK "Ok"
70 
71 // power failures
72 #define E_POWER_PRIM_ON 145 // Power is on whilst it shouldn't be
73 #define E_POWER_PRIM_OFF 146 // Power is off whilst it should be
74 
75 #define E_POWER_SEC_ON 147 // Power is on whilst it shouldn't be
76 #define E_POWER_SEC_OFF 148 // Power is off whilst it should be
77 #define E_POWER 150 // Nothing is online
78 
79 #define E_VFD_OFFLINE E_POWER_PRIM_OFF // VFD should be online
80 
81 // sensor failures
82 #define E_VFD_CURRENT 200 // VFD current abnormal: below or above average
83 #define E_OPERATING_SWITCH 220 // Operating switch invalid value
84 
86 //
87 // Sub system failures
88 //
89 
90 // motor
91 #define E_MOTOR_DT_IDLE 320 // Motor runs idle longer as defined
92 #define E_MOTOR_DT_OVERLOAD 321 // Motor runs overloaded longer as defined
93 #define E_BRIDGE_LOSS 400 // bridge poll timeout
94 
95 // bridge
96 #define E_BRIDGE_START 3000 // base offset for custom bridge errors
97 #define E_BRIDGE_CUSTOM(A) E_BRIDGE_START+A // Custom bridge error
98 #define E_BRIDGE_PARITY E_BRIDGE_CUSTOM(1) // @todo, parity check failure
99 #define E_BRIDGE_CRC E_BRIDGE_CUSTOM(2) // @todo, crc failure
100 #define E_BRIDGE_FLOOD E_BRIDGE_CUSTOM(3) // @todo, msg queue
101 
102 // extrusion
103 #define E_EX_BASE 4000 // base offset extruder
104 #define E_EX_CUSTOM(A) E_EX_BASE+A // Custom bridge error
105 
107 //
108 // I/O Advanced Settings - Board/Platform specific
109 
110 #define ANALOG_POT_READ_INTERVAL 15 // The interval to read the analog switch
111 #define ANALOG_SWITCH_READ_INTERVAL 20 // The interval to read the analog switch
112 
113 
114 #define ANALOG_INPUT_MAX_LEVEL_0 750 // The trigger value to detect an analog input value as HIGH or ON
115 
116 #define ANALOG_INPUT_MAX_LEVEL_1 810 // The maximum value for the analog input (POT)
117 #define ANALOG_INPUT_THRESHOLD_1 500 // The trigger value to detect an analog input value as HIGH or ON
118 
119 #define ANALOG_INPUT_MIN_THRESHOLD_0 700 // Minimum threshold for 3Pos switches
120 #define ANALOG_INPUT_MIN_DT_0 3 // Minimum difference to detect a change in the analog input
121 
123 //
124 // Stepper Advanced Settings
125 //
126 
127 #define STEPPER_MAX_SPEED_0 1500 // For non Teknic servos, please use values below 1000, otherwise it will jitter
128 #define STEPPER_MODUBUS_RANGE 4
129 #define STEPPER_DEFAULT_SPEED_0 1
130 #define STEPPER_DEFAULT_DIR_0 1
131 #define STEPPER_PULSE_WIDTH_0 40
132 #define STEPPER_OVERLOAD_THRESHOLD_0 800
133 
134 
135 #endif