Improved readout by secondary address
- save 1 REQ_UD2 by selecting instead of probing seconday address
This commit is contained in:
@ -29,7 +29,7 @@ main(int argc, char **argv)
|
|||||||
mbus_frame_data reply_data;
|
mbus_frame_data reply_data;
|
||||||
mbus_handle *handle = NULL;
|
mbus_handle *handle = NULL;
|
||||||
|
|
||||||
char *device, *addr_str, matching_addr[16], *xml_result;
|
char *device, *addr_str, *xml_result;
|
||||||
int address, baudrate = 9600;
|
int address, baudrate = 9600;
|
||||||
|
|
||||||
memset((void *)&reply, 0, sizeof(mbus_frame));
|
memset((void *)&reply, 0, sizeof(mbus_frame));
|
||||||
@ -116,23 +116,23 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// secondary addressing
|
// secondary addressing
|
||||||
|
|
||||||
int probe_ret;
|
int ret;
|
||||||
|
|
||||||
probe_ret = mbus_probe_secondary_address(handle, addr_str, matching_addr);
|
ret = mbus_select_secondary_address(handle, addr_str);
|
||||||
|
|
||||||
if (probe_ret == MBUS_PROBE_COLLISION)
|
if (ret == MBUS_PROBE_COLLISION)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_NOTHING)
|
else if (ret == MBUS_PROBE_NOTHING)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_ERROR)
|
else if (ret == MBUS_PROBE_ERROR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: Failed to select secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// else MBUS_PROBE_SINGLE
|
// else MBUS_PROBE_SINGLE
|
||||||
|
@ -29,7 +29,7 @@ main(int argc, char **argv)
|
|||||||
mbus_frame_data reply_data;
|
mbus_frame_data reply_data;
|
||||||
mbus_handle *handle = NULL;
|
mbus_handle *handle = NULL;
|
||||||
|
|
||||||
char *device, *addr_str, matching_addr[16];
|
char *device, *addr_str;
|
||||||
int address, baudrate = 9600;
|
int address, baudrate = 9600;
|
||||||
|
|
||||||
if (argc == 3)
|
if (argc == 3)
|
||||||
@ -87,23 +87,23 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// secondary addressing
|
// secondary addressing
|
||||||
|
|
||||||
int probe_ret;
|
int ret;
|
||||||
|
|
||||||
probe_ret = mbus_probe_secondary_address(handle, addr_str, matching_addr);
|
ret = mbus_select_secondary_address(handle, addr_str);
|
||||||
|
|
||||||
if (probe_ret == MBUS_PROBE_COLLISION)
|
if (ret == MBUS_PROBE_COLLISION)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_NOTHING)
|
else if (ret == MBUS_PROBE_NOTHING)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_ERROR)
|
else if (ret == MBUS_PROBE_ERROR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: Failed to select secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// else MBUS_PROBE_SINGLE
|
// else MBUS_PROBE_SINGLE
|
||||||
|
@ -72,23 +72,23 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// secondary addressing
|
// secondary addressing
|
||||||
|
|
||||||
int probe_ret;
|
int ret;
|
||||||
|
|
||||||
probe_ret = mbus_probe_secondary_address(handle, addr_str, matching_addr);
|
ret = mbus_select_secondary_address(handle, addr_str);
|
||||||
|
|
||||||
if (probe_ret == MBUS_PROBE_COLLISION)
|
if (ret == MBUS_PROBE_COLLISION)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_NOTHING)
|
else if (ret == MBUS_PROBE_NOTHING)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_ERROR)
|
else if (ret == MBUS_PROBE_ERROR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: Failed to select secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// else MBUS_PROBE_SINGLE
|
// else MBUS_PROBE_SINGLE
|
||||||
|
@ -72,23 +72,23 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// secondary addressing
|
// secondary addressing
|
||||||
|
|
||||||
int probe_ret;
|
int ret;
|
||||||
|
|
||||||
probe_ret = mbus_probe_secondary_address(handle, addr_str, matching_addr);
|
ret = mbus_select_secondary_address(handle, addr_str);
|
||||||
|
|
||||||
if (probe_ret == MBUS_PROBE_COLLISION)
|
if (ret == MBUS_PROBE_COLLISION)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_NOTHING)
|
else if (ret == MBUS_PROBE_NOTHING)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (probe_ret == MBUS_PROBE_ERROR)
|
else if (ret == MBUS_PROBE_ERROR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: Failed to select secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// else MBUS_PROBE_SINGLE
|
// else MBUS_PROBE_SINGLE
|
||||||
|
Reference in New Issue
Block a user