Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kev9268
Copy link
Contributor

@kev9268 kev9268 commented Nov 8, 2024

No description provided.

Copy link
Contributor

@DeflateAwning DeflateAwning left a 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(
Copy link
Contributor

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:
Copy link
Contributor

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(
Copy link
Contributor

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.

Copy link
Contributor Author

@kev9268 kev9268 Nov 26, 2024

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;
Copy link
Contributor

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
Copy link
Contributor

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.

@kev9268 kev9268 force-pushed the kevin-tcmd_eps_channels_currently_enabled-i182 branch 2 times, most recently from 142076e to eb8fc51 Compare November 27, 2024 03:02
@kev9268 kev9268 force-pushed the kevin-tcmd_eps_channels_currently_enabled-i182 branch from eb8fc51 to 3dc3a25 Compare November 27, 2024 03:28
@DeflateAwning
Copy link
Contributor

Please fix merge conflicts. Please write out a couple sentences on how you'd like to test this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EPS: Create a telecommand which yields a list-of-strings of the channels currently enabled
2 participants