|
|
|
|
@ -189,7 +189,7 @@ gboolean mbcli_thread_cb_modbusdata(gpointer data) {
|
|
|
|
|
// integer values (16bit words)
|
|
|
|
|
//
|
|
|
|
|
gtk_text_buffer_get_end_iter(textbuffer, &end);
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &end, " Addr RawData Integer Float Float(SW)\n", -1, "Head", NULL);
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &end, " Addr RawData UInt16 SInt16 Float Float(SW)\n", -1, "Head", NULL);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < res->cnt; i++) {
|
|
|
|
|
// add addr to textbuffer
|
|
|
|
|
@ -199,18 +199,18 @@ gboolean mbcli_thread_cb_modbusdata(gpointer data) {
|
|
|
|
|
|
|
|
|
|
// add data to textbuffer
|
|
|
|
|
text = to_hex16((int) res->data[i]);
|
|
|
|
|
if ((res->reg + i)%2 == 0 && i < res->cnt-1) {
|
|
|
|
|
if (i < res->cnt-1) {
|
|
|
|
|
memcpy (((char*)&f1) + 0, &res->data[i], 2);
|
|
|
|
|
memcpy (((char*)&f1) + 2, &res->data[i+1], 2);
|
|
|
|
|
|
|
|
|
|
memcpy (((char*)&f2) + 2, &res->data[i], 2);
|
|
|
|
|
memcpy (((char*)&f2) + 0, &res->data[i+1], 2);
|
|
|
|
|
|
|
|
|
|
snprintf (tmp, 255, " | %6d | %9.3g | %9.3g", res->data[i], f1, f2);
|
|
|
|
|
snprintf (tmp, 255, " | %6d | %6d | %11.5g | %11.5g", res->data[i], (int16_t) res->data[i], f1, f2);
|
|
|
|
|
text = text + tmp;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
snprintf (tmp, 255, " | %6d | | ", res->data[i]);
|
|
|
|
|
snprintf (tmp, 255, " | %6d | %6d | | ", res->data[i]);
|
|
|
|
|
text = text + tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|