-
Notifications
You must be signed in to change notification settings - Fork 354
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
Support for Korad KKG305P #219
base: master
Are you sure you want to change the base?
Conversation
Support for KKG305P with new quirk. korad_kaxxxxp_send_cmd() changed in a way to support adding new line termination. STATUS parsed according to Korad "documentation". New flags in device structure to support status of remote sensing status and external control interface status.
Hi, thanks for your contribution! Would you be so kind and rebase your branch on top of current git head to solve the conflicts? |
I will try and let you know. |
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.
(note I am neither a main dev or maintainer of sigrok. Just a 'concerned citizen')
I don't see major problems, but I wonder about the choice of changing every call to korad_kaxxxxp_send_cmd()
with the extra arg.
I think I would've implemented a new korad_kkg_send_cmd()
with the newline fixes (but no additional argument); change the korad_kaxxxxp_send_cmd()
call sites to a instead call a *function pointer, and set that function pointer once at device init according to device type. Then after writing that I would then start doubting on whether it was a even a good idea.
Hope we get some input from others about this
{ | ||
int ret; | ||
uint32_t cmd_len; | ||
char *_cmd; |
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.
not a fan of leading underscores for var names
} | ||
|
||
sr_dbg("Sending '%s'.", _cmd); |
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.
suggest moving this before you append the newline, so the debug message doesn't end up with sometimes a stray \n ?
} | ||
|
||
sr_dbg("Sending '%s'.", _cmd); | ||
if ((ret = serial_write_blocking(serial, _cmd, cmd_len, 0)) < 0) { |
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.
move the assignment outside the conditional
@@ -323,16 +341,35 @@ SR_PRIV int korad_kaxxxxp_get_value(struct sr_serial_dev_inst *serial, | |||
prev_status = devc->cc_mode[0]; | |||
devc->cc_mode[0] = !(status_byte & (1 << 0)); | |||
devc->cc_mode_1_changed = devc->cc_mode[0] != prev_status; | |||
|
|||
if( devc->model->quirks & KORAD_QUIRK_KKG_FAMILY) { | |||
/* |
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.
missing indent inside block, bad whitespace in if(
|
||
/* | ||
* Tracking: | ||
* status_byte & ((1 << 2) | (1 << 3)) | ||
* 00 independent 01 series 11 parallel | ||
*/ | ||
|
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.
unrelated whitespace
(status_byte & (1 << 5)) ? "enabled" : "disabled", | ||
(status_byte & (1 << 7)) ? "enabled" : "disabled", | ||
(status_byte & (1 << 4)) ? "beeping" : "silent"); | ||
if( devc->model->quirks & KORAD_QUIRK_KKG_FAMILY) { |
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.
another if(
|
||
gboolean cc_mode_1_changed; /**< CC mode of channel 1 has changed. */ | ||
gboolean cc_mode_2_changed; /**< CC mode of channel 2 has changed. */ | ||
gboolean output_enabled_changed; /**< Output enabled state has changed. */ | ||
gboolean ocp_enabled_changed; /**< OCP enabled state has changed. */ | ||
gboolean ovp_enabled_changed; /**< OVP enabled state has changed. */ | ||
gboolean rmt_comp_changed; /**< Is remote compensation enabled. */ |
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.
wrong copypasted comment here and below, enabled
-> changed
Also forgot to mention, one of these commits |
Support for KKG305P with new quirk.
korad_kaxxxxp_send_cmd() changed in a way to support new line termination.
STATUS parsed according to Korad "documentation".
New flags in device structure to support status of remote sensing status and external control interface status.