From 4b140e476d17fa07c02341e3f50abc2a404ffd3c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:05:28 +0200 Subject: [PATCH] Limit servo count in blackbox to 26. I will deal with size 64bit limit on conditions later. --- src/main/blackbox/blackbox.c | 24 +++++++++++++++++++++++- src/main/blackbox/blackbox_fielddefs.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index fc88ac12b..ebb4f72a4 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -360,6 +360,7 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = { {"servo", 23, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_23)}, {"servo", 24, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_24)}, {"servo", 25, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_25)}, + /* {"servo", 26, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_26)}, {"servo", 27, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_27)}, {"servo", 27, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_28)}, @@ -369,6 +370,7 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = { {"servo", 31, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_32)}, {"servo", 32, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_33)}, {"servo", 33, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_34)}, + */ {"navState", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, {"navFlags", -1, UNSIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, @@ -691,7 +693,27 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition) case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_16: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_17: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_18: - return ((FlightLogFieldCondition)getServoCount() >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1); + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_19: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_20: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_21: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_22: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_23: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_24: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_25: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_26: + /* + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_27: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_28: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_29: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_30: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_31: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_32: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_33: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_34: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_35: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_36: + */ + return ((FlightLogFieldCondition)MIN(getServoCount(), 26) >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1); case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0: case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_1: diff --git a/src/main/blackbox/blackbox_fielddefs.h b/src/main/blackbox/blackbox_fielddefs.h index 43d9542da..17595157d 100644 --- a/src/main/blackbox/blackbox_fielddefs.h +++ b/src/main/blackbox/blackbox_fielddefs.h @@ -61,6 +61,7 @@ typedef enum FlightLogFieldCondition { FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_24, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_25, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_26, + /* FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_27, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_28, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_29, @@ -69,6 +70,7 @@ typedef enum FlightLogFieldCondition { FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_32, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_33, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_34, + */ FLIGHT_LOG_FIELD_CONDITION_MAG, FLIGHT_LOG_FIELD_CONDITION_BARO, -- 2.11.4.GIT