Skip to content

Commit

Permalink
bb: increase debug field size
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Aug 4, 2024
1 parent 4db4b56 commit 27f6d7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/io/blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ cbor_result_t cbor_encode_blackbox_t(cbor_value_t *enc, const blackbox_t *b, con
}

if (field_flags & (1 << BBOX_FIELD_DEBUG)) {
CBOR_CHECK_ERROR(res = cbor_encode_array(enc, 4));
CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[0]));
CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[1]));
CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[2]));
CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[3]));
CBOR_CHECK_ERROR(res = cbor_encode_array(enc, BLACKBOX_DEBUG_SIZE));
for (uint32_t i = 0; i < BLACKBOX_DEBUG_SIZE; i++) {
CBOR_CHECK_ERROR(res = cbor_encode_int16_t(enc, &b->debug[i]));
}
}

CBOR_CHECK_ERROR(res = cbor_encode_end_indefinite(enc));
Expand All @@ -80,7 +79,7 @@ void blackbox_init() {
}

void blackbox_set_debug(uint8_t index, int16_t data) {
if (index >= 4) {
if (index >= BLACKBOX_DEBUG_SIZE) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion src/io/blackbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "core/profile.h"

#define BLACKBOX_SCALE 1000
#define BLACKBOX_DEBUG_SIZE 10

typedef struct {
uint32_t loop;
Expand All @@ -25,7 +26,7 @@ typedef struct {

uint16_t cpu_load;

int16_t debug[4];
int16_t debug[BLACKBOX_DEBUG_SIZE];
} blackbox_t;

// Blackbox fields (should align with above structure)
Expand Down

0 comments on commit 27f6d7e

Please sign in to comment.