-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCMD output into list of strings, EPS channels currently enabled #232
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work! Just a few changes (both architectural and functional).
@@ -91,6 +91,10 @@ uint8_t TCMDEXEC_eps_get_piu_housekeeping_data_run_avg_json( | |||
char *response_output_buf, uint16_t response_output_buf_len | |||
); | |||
|
|||
uint8_t TCMDEXEC_eps_get_list_of_enabled_channels( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename to TCMDEXEC_eps_get_enabled_channels_json
(ie remove "list of"). Will give the result as JSON.
uint8_t bit_status = (status_bitfield >> i) & 1; // bit shift right and then check bit status | ||
if (bit_status == 1) { | ||
switch (i) { | ||
case EPS_CHANNEL_VBATT_STACK: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refactor this switch statement into a function (if it does not already exist) which converts it to just a string.
Please put it in Core/Src/eps_drivers/eps_channel_control.c
. See that file for an example of the string conversion. Consider using ChatGPT with clever prompting to invert the existing switch statement there.
@@ -520,3 +520,82 @@ uint8_t TCMDEXEC_eps_get_piu_housekeeping_data_run_avg_json( | |||
return 0; | |||
} | |||
|
|||
uint8_t TCMDEXEC_eps_get_list_of_enabled_channels( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this function to give the output as a JSON list-of-strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the channels to be the keys or have the list-of-string itself be just one single value for a key?
return 1; | ||
} | ||
|
||
uint16_t status_bitfield = status.stat_ch_on_bitfield; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mark as const
uint16_t status_bitfield = status.stat_ch_on_bitfield; | ||
uint16_t status_oc_bitfield = status.stat_ch_overcurrent_fault_bitfield; | ||
strcat(response_output_buf, "Current Channels Enabled: "); | ||
for (int i =0; i<16; i++){ // check bit field for channels 0-15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use precise integer type (e.g., uint8_t
) instead of int
.
142076e
to
eb8fc51
Compare
eb8fc51
to
3dc3a25
Compare
Please fix merge conflicts. Please write out a couple sentences on how you'd like to test this! |
No description provided.