Run clang-format and enable CI check for it (#755)
* pre-commit: Update and enable clang-format check There is newer version from clang-format so use that. We do not yet want 18 as that is little bit too new. * Format some thing by hand which clang-format "breaks" Clang-format will format some things little bit off in some cases. Format some things by hand so we get cleaner end result. * Run clang-format with ``` pre-commit run --all-files clang-format ``` We have already in previously checked places where clang-format does not make good format and ignored those (hopefully most of the things). --------- Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
+31
-23
@@ -68,17 +68,18 @@ static void print_help(const char *filename)
|
||||
"you are reading. For example, if you were reading\n"
|
||||
"Analog Output 2, the object-instance would be 2.\n");
|
||||
PRINTF("\n");
|
||||
PRINTF("Example:\n"
|
||||
"If you want read the Present-Value of Analog Output 101\n"
|
||||
"in Device 123, you could send either of the following\n"
|
||||
"commands:\n"
|
||||
"%s 123 analog-output 101\n"
|
||||
"%s 123 1 101\n"
|
||||
"If you want read the Present-Value of Binary Input 1\n"
|
||||
"in Device 123, you could send either of the following\n"
|
||||
"commands:\n"
|
||||
"%s 123 binary-input 1\n"
|
||||
"%s 123 3 1\n",
|
||||
PRINTF(
|
||||
"Example:\n"
|
||||
"If you want read the Present-Value of Analog Output 101\n"
|
||||
"in Device 123, you could send either of the following\n"
|
||||
"commands:\n"
|
||||
"%s 123 analog-output 101\n"
|
||||
"%s 123 1 101\n"
|
||||
"If you want read the Present-Value of Binary Input 1\n"
|
||||
"in Device 123, you could send either of the following\n"
|
||||
"commands:\n"
|
||||
"%s 123 binary-input 1\n"
|
||||
"%s 123 3 1\n",
|
||||
filename, filename, filename, filename);
|
||||
}
|
||||
|
||||
@@ -125,8 +126,9 @@ int main(int argc, char *argv[])
|
||||
if (++argi < argc) {
|
||||
device_id = strtol(argv[argi], NULL, 0);
|
||||
if (device_id > BACNET_MAX_INSTANCE) {
|
||||
fprintf(stderr, "device=%u - not greater than %u\n",
|
||||
device_id, BACNET_MAX_INSTANCE);
|
||||
fprintf(
|
||||
stderr, "device=%u - not greater than %u\n", device_id,
|
||||
BACNET_MAX_INSTANCE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -161,22 +163,25 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
Device_Set_Object_Instance_Number(device_id);
|
||||
if (target_device_object_instance > BACNET_MAX_INSTANCE) {
|
||||
fprintf(stderr, "device-instance=%u - not greater than %u\n",
|
||||
fprintf(
|
||||
stderr, "device-instance=%u - not greater than %u\n",
|
||||
target_device_object_instance, BACNET_MAX_INSTANCE);
|
||||
return 1;
|
||||
}
|
||||
PRINTF("BACnet Server-Client Demo\n"
|
||||
"BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n"
|
||||
"Max APDU: %d\n",
|
||||
PRINTF(
|
||||
"BACnet Server-Client Demo\n"
|
||||
"BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n"
|
||||
"Max APDU: %d\n",
|
||||
BACnet_Version, Device_Object_Instance_Number(), MAX_APDU);
|
||||
fflush(stdout);
|
||||
dlenv_init();
|
||||
atexit(datalink_cleanup);
|
||||
bacnet_task_init();
|
||||
bacnet_data_poll_seconds_set(print_seconds);
|
||||
if (!bacnet_data_object_add(target_device_object_instance,
|
||||
target_object_type, target_object_instance)) {
|
||||
if (!bacnet_data_object_add(
|
||||
target_device_object_instance, target_object_type,
|
||||
target_object_instance)) {
|
||||
return 1;
|
||||
}
|
||||
mstimer_set(&print_value_timer, print_seconds * 1000);
|
||||
@@ -192,7 +197,8 @@ int main(int argc, char *argv[])
|
||||
if (bacnet_data_analog_present_value(
|
||||
target_device_object_instance, target_object_type,
|
||||
target_object_instance, &float_value)) {
|
||||
PRINTF("Device %u %s-%u=%f\n",
|
||||
PRINTF(
|
||||
"Device %u %s-%u=%f\n",
|
||||
(unsigned)target_device_object_instance,
|
||||
bactext_object_type_name(target_object_type),
|
||||
(unsigned)target_object_instance, float_value);
|
||||
@@ -204,7 +210,8 @@ int main(int argc, char *argv[])
|
||||
if (bacnet_data_binary_present_value(
|
||||
target_device_object_instance, target_object_type,
|
||||
target_object_instance, &bool_value)) {
|
||||
PRINTF("Device %u %s-%u=%s\n",
|
||||
PRINTF(
|
||||
"Device %u %s-%u=%s\n",
|
||||
(unsigned)target_device_object_instance,
|
||||
bactext_object_type_name(target_object_type),
|
||||
(unsigned)target_object_instance,
|
||||
@@ -217,7 +224,8 @@ int main(int argc, char *argv[])
|
||||
if (bacnet_data_multistate_present_value(
|
||||
target_device_object_instance, target_object_type,
|
||||
target_object_instance, &unsigned_value)) {
|
||||
PRINTF("Device %u %s-%u=%u\n",
|
||||
PRINTF(
|
||||
"Device %u %s-%u=%u\n",
|
||||
(unsigned)target_device_object_instance,
|
||||
bactext_object_type_name(target_object_type),
|
||||
(unsigned)target_object_instance,
|
||||
|
||||
Reference in New Issue
Block a user