Changed error codes to negative integers

This commit is contained in:
Jan Gromeš 2018-07-23 11:16:14 +02:00
parent db9983b3e5
commit 2d788da0c2

View file

@ -57,53 +57,55 @@
#define UART_FLOW_BOTH 0x03 #define UART_FLOW_BOTH 0x03
// Common status codes // Common status codes
#define ERR_NONE 0x00 #define ERR_NONE 0
#define ERR_UNKNOWN 0x63 // maximum status code value is 99 DEC, so that it does not interfere with HTTP status codes #define ERR_UNKNOWN -1
// SX1278/SX1272/RF69 status codes // SX1278/SX1272/RF69 status codes
#define ERR_CHIP_NOT_FOUND 0x01 #define ERR_CHIP_NOT_FOUND -2
#define ERR_EEPROM_NOT_INITIALIZED 0x02 #define ERR_EEPROM_NOT_INITIALIZED -3
#define ERR_PACKET_TOO_LONG 0x03 #define ERR_PACKET_TOO_LONG -4
#define ERR_TX_TIMEOUT 0x04 #define ERR_TX_TIMEOUT -5
#define ERR_RX_TIMEOUT 0x05 #define ERR_RX_TIMEOUT -6
#define ERR_CRC_MISMATCH 0x06 #define ERR_CRC_MISMATCH -7
#define ERR_INVALID_BANDWIDTH 0x07 #define ERR_INVALID_BANDWIDTH -8
#define ERR_INVALID_SPREADING_FACTOR 0x08 #define ERR_INVALID_SPREADING_FACTOR -9
#define ERR_INVALID_CODING_RATE 0x09 #define ERR_INVALID_CODING_RATE -10
#define ERR_INVALID_BIT_RANGE 0x0A #define ERR_INVALID_BIT_RANGE -11
#define ERR_INVALID_FREQUENCY 0x0B #define ERR_INVALID_FREQUENCY -12
#define ERR_INVALID_OUTPUT_POWER 0x0C #define ERR_INVALID_OUTPUT_POWER -13
#define PREAMBLE_DETECTED 0x0D #define PREAMBLE_DETECTED -14
#define CHANNEL_FREE 0x0E #define CHANNEL_FREE -15
#define ERR_SPI_WRITE_FAILED -16
// RF69-specific status codes // RF69-specific status codes
#define ERR_INVALID_BIT_RATE 0x0F #define ERR_INVALID_BIT_RATE -101
#define ERR_INVALID_FREQUENCY_DEVIATION 0x10 #define ERR_INVALID_FREQUENCY_DEVIATION -102
#define ERR_INVALID_BIT_RATE_BW_RATIO 0x11 #define ERR_INVALID_BIT_RATE_BW_RATIO -103
#define ERR_INVALID_RX_BANDWIDTH 0x12 #define ERR_INVALID_RX_BANDWIDTH -104
#define ERR_INVALID_SYNC_WORD 0x13 #define ERR_INVALID_SYNC_WORD -105
// ESP8266 status codes // ESP8266 status codes
#define ERR_AT_FAILED 0x01 #define ERR_AT_FAILED -201
#define ERR_URL_MALFORMED 0x02 #define ERR_URL_MALFORMED -202
#define ERR_RESPONSE_MALFORMED_AT 0x03 #define ERR_RESPONSE_MALFORMED_AT -203
#define ERR_RESPONSE_MALFORMED 0x04 #define ERR_RESPONSE_MALFORMED -204
#define ERR_MQTT_CONN_VERSION_REJECTED 0x05 #define ERR_MQTT_CONN_VERSION_REJECTED -205
#define ERR_MQTT_CONN_ID_REJECTED 0x06 #define ERR_MQTT_CONN_ID_REJECTED -206
#define ERR_MQTT_CONN_SERVER_UNAVAILABLE 0x07 #define ERR_MQTT_CONN_SERVER_UNAVAILABLE -207
#define ERR_MQTT_CONN_BAD_USERNAME_PASSWORD 0x08 #define ERR_MQTT_CONN_BAD_USERNAME_PASSWORD -208
#define ERR_MQTT_CONN_NOT_AUTHORIZED 0x09 #define ERR_MQTT_CONN_NOT_AUTHORIZED -208
#define ERR_MQTT_UNEXPECTED_PACKET_ID 0x0A #define ERR_MQTT_UNEXPECTED_PACKET_ID -209
#define ERR_MQTT_NO_NEW_PACKET_AVAILABLE 0x0B #define ERR_MQTT_NO_NEW_PACKET_AVAILABLE -210
#define MQTT_SUBS_SUCCESS_QOS_0 0x00 #define MQTT_SUBS_SUCCESS_QOS_0 0x00
#define MQTT_SUBS_SUCCESS_QOS_1 0x01 #define MQTT_SUBS_SUCCESS_QOS_1 0x01
#define MQTT_SUBS_SUCCESS_QOS_2 0x02 #define MQTT_SUBS_SUCCESS_QOS_2 0x02
#define ERR_MQTT_SUBS_FAILED 0x80 #define ERR_MQTT_SUBS_FAILED 0x80
// XBee status codes // XBee status codes
#define ERR_CMD_MODE_FAILED 0x02 #define ERR_AT_FAILED -301
#define ERR_FRAME_MALFORMED 0x03 #define ERR_CMD_MODE_FAILED -302
#define ERR_FRAME_INCORRECT_CHECKSUM 0x04 #define ERR_FRAME_MALFORMED -303
#define ERR_FRAME_UNEXPECTED_ID 0x05 #define ERR_FRAME_INCORRECT_CHECKSUM -304
#define ERR_FRAME_UNEXPECTED_ID -305
#endif #endif