N4 Flight Software N4
Flight software used for the N4 flight computers
Loading...
Searching...
No Matches
defs.h
Go to the documentation of this file.
1
5
6#ifndef DEFS_H
7#define DEFS_H
8
9#include <Arduino.h>
10
14#define MQTT 0
15#define XBEE 0
16
17#define BAUDRATE 115200
18#define GPS_BAUD_RATE 9600
19#define XBEE_BAUD_RATE 9600
20
21/* debug parameters for use during testing - set to 0 for production */
22#define DEBUGGING 1
23#define LOG_TO_MEMORY 0
24#define DEBUG_TO_TERMINAL 0
25
26#if DEBUGGING
27 #define debug(x) Serial.print(x)
28 #define debugln(x) Serial.println(x)
29 #define debugf(x, y) Serial.printf(x, y)
30#else
31 #define debug(x)
32 #define debugln(x)
33 #define debugf(x, y)
34#endif // DEBUG
35
36/* end of debug parameters */
37
38/* MPU config parameters */
39#define MPU_ADDRESS 0x68
40#define MPU_ACCEL_RANGE 16
41#define GYRO_RANGE 1000 /* 1000 deg/s */
42#define WIRE_SEND_STOP 0
43
44/* other pins */
45#define GREEN_LED_PIN 15
46#define RED_LED_PIN 4
47#define BUZZER_PIN 33
48#define SET_TEST_MODE_PIN 14
49#define SET_RUN_MODE_PIN 13
50#define SD_CS_PIN 26
51#define REMOTE_SWITCH 27
52
53/* timing constant */
54#define SETUP_DELAY 300
55#define TASK_DELAY 10
56
58#define ALTITUDE 1525.0 // altitude of iPIC building, JKUAT, Juja. TODO: Change to launch site altitude
59#define LAUNCH_DETECTION_THRESHOLD 10
60#define LAUNCH_DETECTION_ALTITUDE_WINDOW 20
61#define APOGEE_DETECTION_THRESHOLD 5
62#define MAIN_EJECTION_HEIGHT 1000
63#define DROGUE_EJECTION_HEIGHT
64#define SEA_LEVEL_PRESSURE 101325
65#define BASE_ALTITUDE 1417
66
68#define STACK_SIZE 1024
69#define ALTIMETER_QUEUE_LENGTH 10
70#define GYROSCOPE_QUEUE_LENGTH 10
71#define GPS_QUEUE_LENGTH 24
72#define TELEMETRY_DATA_QUEUE_LENGTH 10
73#define FILTERED_DATA_QUEUE_LENGTH 10
74#define FLIGHT_STATES_QUEUE_LENGTH 1
75#define CONSUME_TASK_DELAY 10
76
77/* MQTT constants */
78const char MQTT_SERVER[30] = "192.168.1.125";
79const char MQTT_TELEMETRY_TOPIC[30] = "n4/flight-computer-1"; /* make this topic unique to every rocket */
80const char MQTT_ARMING_TOPIC[30] = "n4/commands"; /* make this topic unique to every rocket */
81#define MQTT_PORT 1883
82
83#define BROKER_IP_ADDRESS_LENGTH 20
84#define MQTT_TOPIC_LENGTH 10
85
86/* WIFI credentials */
87// const char* SSID = "Galaxy"; /*!< WIFi SSID */
88// const char* PASSWORD = "luwa2131"; /*!< WiFi password */
89
90#define CALLIBRATION_READINGS 200
91
92#define GPS_TX 17
93#define GPS_RX 16
94
95/* File systems defines */
96#define MB_SIZE_DIVISOR 1048576
97#define FORMAT_SPIFFS_IF_FAILED 1
98
99#define PREFLIGHT_BIT 0
100#define POWERED_FLIGHT_BIT 1
101#define APOGEE_BIT 2
102
103#define STATE_CHANGE_DELAY 20
104#endif // DEFS_H
105