Skip to content

Commit

Permalink
feat: update canlib and error-handler versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonidotpy committed Apr 17, 2024
1 parent ec0255e commit 80eee64
Show file tree
Hide file tree
Showing 9 changed files with 1,772 additions and 1,767 deletions.
6 changes: 3 additions & 3 deletions mainboard/Inc/error/error-handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Generated by error_gen ruby gem, for more information see:
* https://github.com/eagletrt/micro-utils/tree/master/error-handler-generator
*
* Error_gen version 1.3.0
* Generation date: 2024-03-24 12:45:37 +0100
* Generation from:
* Error_gen version 1.3.3
* Generation date: 2024-04-15 15:45:58 +0200
* Generated from: errors.json
* The error handler contains:
* - 15 error groups
* - 66 total error instances
Expand Down
30 changes: 15 additions & 15 deletions mainboard/Src/error/error-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Generated by error_gen ruby gem, for more information see:
* https://github.com/eagletrt/micro-utils/tree/master/error-handler-generator
*
* Error_gen version 1.3.0
* Generation date: 2024-03-24 12:45:37 +0100
* Generation from:
* Error_gen version 1.3.3
* Generation date: 2024-04-15 15:45:58 +0200
* Generated from: errors.json
* The error handler contains:
* - 15 error groups
* - 66 total error instances
Expand Down Expand Up @@ -155,7 +155,7 @@ void _error_set(ErrorData data) {

// Add error to the running list of errors and
// update timer if the error is the first to expire
if (!min_heap_insert(&running_errors, &err))
if (min_heap_insert(&running_errors, &err) != MIN_HEAP_OK)
return;
Error ** top = (Error **)min_heap_peek(&running_errors);
if (top != NULL && *top == err)
Expand All @@ -179,18 +179,18 @@ void _error_reset(ErrorData data) {

// Get the current first element
Error * top = NULL;
if (!min_heap_top(&running_errors, &top))
if (min_heap_top(&running_errors, &top) != MIN_HEAP_OK)
return;

if (top == err) {
// If the removed error is the first in the heap
// remove it and update (or stop) the timer
if (!min_heap_remove(&running_errors, 0, NULL))
if (min_heap_remove(&running_errors, 0, NULL) != MIN_HEAP_OK)
return;

if (min_heap_is_empty(&running_errors))
error_stop_timer_callback();
else if (min_heap_top(&running_errors, &top))
else if (min_heap_top(&running_errors, &top) == MIN_HEAP_OK)
error_update_timer_callback(top->timestamp, timeouts[top->group]);
}
else {
Expand All @@ -209,7 +209,7 @@ void _error_reset(ErrorData data) {
void _error_expire(ErrorData data) {
// Get error
Error * top = NULL;
if (!min_heap_top(&running_errors, &top))
if (min_heap_top(&running_errors, &top) != MIN_HEAP_OK)
return;

if (!top->is_running || top->is_expired)
Expand All @@ -223,11 +223,11 @@ void _error_expire(ErrorData data) {
++expired_groups[data.group];

// Add error to the list of expired errors
if (!ring_buffer_push_back(&expired_errors, top))
if (ring_buffer_push_back(&expired_errors, &top) != RING_BUFFER_OK)
break;

// Get next error and remove the previous
if (!min_heap_remove(&running_errors, 0, NULL))
if (min_heap_remove(&running_errors, 0, NULL) != MIN_HEAP_OK)
break;

// Stop the timer if there are no more errors
Expand All @@ -237,7 +237,7 @@ void _error_expire(ErrorData data) {
}

// Get next errors
if (!min_heap_top(&running_errors, &top))
if (min_heap_top(&running_errors, &top) != MIN_HEAP_OK)
break;
} while(_error_compare(&top, &prev) <= 0);

Expand Down Expand Up @@ -351,7 +351,7 @@ void error_set(ErrorGroup group, ErrorInstance instance, uint32_t timestamp) {
.timestamp = timestamp,
.op = _error_set
};
if (ring_buffer_push_back(&err_buf, &data))
if (ring_buffer_push_back(&err_buf, &data) == RING_BUFFER_OK)
error_routine();
}
void error_reset(ErrorGroup group, ErrorInstance instance) {
Expand All @@ -365,13 +365,13 @@ void error_reset(ErrorGroup group, ErrorInstance instance) {
.timestamp = 0,
.op = _error_reset
};
if (ring_buffer_push_back(&err_buf, &data))
if (ring_buffer_push_back(&err_buf, &data) == RING_BUFFER_OK)
error_routine();
}
void error_expire(void) {
// Push data to the buffer
ErrorData data = { .op = _error_expire };
if (ring_buffer_push_back(&err_buf, &data))
if (ring_buffer_push_back(&err_buf, &data) == RING_BUFFER_OK)
error_routine();
}
void error_routine(void) {
Expand All @@ -388,7 +388,7 @@ void error_routine(void) {

// Execute the right function for the error
ErrorData err;
if (ring_buffer_pop_front(&err_buf, &err))
if (ring_buffer_pop_front(&err_buf, &err) == RING_BUFFER_OK)
err.op(err);

routine_lock = false;
Expand Down
1 change: 1 addition & 0 deletions mainboard/Src/pack/pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GPIO_PinState pack_get_airn_off() {
return HAL_GPIO_ReadPin(AIRN_OFF_GPIO_Port, AIRN_OFF_Pin);
}
void pack_set_airn_off(GPIO_PinState value) {

HAL_GPIO_WritePin(AIRN_OFF_GPIO_Port, AIRN_OFF_Pin, value);
}

Expand Down

0 comments on commit 80eee64

Please sign in to comment.