Ran indent script.
This commit is contained in:
@@ -61,8 +61,7 @@ static uint8_t RxBuffer[MAX_MPDU];
|
||||
static uint8_t TxBuffer[MAX_MPDU];
|
||||
|
||||
/* statistics derived from monitoring the network for each node */
|
||||
struct mstp_statistics
|
||||
{
|
||||
struct mstp_statistics {
|
||||
/* counts how many times the node passes the token */
|
||||
uint32_t token_count;
|
||||
/* counts how many times the node gets a second token */
|
||||
@@ -90,8 +89,8 @@ static uint32_t timeval_diff_ms(
|
||||
uint32_t ms = 0;
|
||||
|
||||
/* convert to milliseconds */
|
||||
ms = (now->tv_sec-old->tv_sec)*1000+
|
||||
(now->tv_usec-old->tv_usec)/1000;
|
||||
ms = (now->tv_sec - old->tv_sec) * 1000 + (now->tv_usec -
|
||||
old->tv_usec) / 1000;
|
||||
|
||||
return ms;
|
||||
}
|
||||
@@ -189,7 +188,8 @@ static void packet_statistics(
|
||||
old_tv.tv_usec = tv->tv_usec;
|
||||
}
|
||||
|
||||
static void packet_statistics_save(void)
|
||||
static void packet_statistics_save(
|
||||
void)
|
||||
{
|
||||
unsigned i; /* loop counter */
|
||||
|
||||
@@ -201,18 +201,15 @@ static void packet_statistics_save(void)
|
||||
fprintf(stdout, "\r\n");
|
||||
for (i = 0; i < 256; i++) {
|
||||
/* check for masters or slaves */
|
||||
if ((MSTP_Statistics[i].token_count) ||
|
||||
(MSTP_Statistics[i].der_reply)) {
|
||||
if ((MSTP_Statistics[i].token_count) || (MSTP_Statistics[i].der_reply)) {
|
||||
fprintf(stdout, "%u\t%u", i,
|
||||
(unsigned) MSTP_Statistics[i].max_master);
|
||||
fprintf(stdout,
|
||||
"\t%lu\t%lu\t%lu\t%lu",
|
||||
fprintf(stdout, "\t%lu\t%lu\t%lu\t%lu",
|
||||
(long unsigned int) MSTP_Statistics[i].token_count,
|
||||
(long unsigned int) MSTP_Statistics[i].token_retries,
|
||||
(long unsigned int) MSTP_Statistics[i].token_reply,
|
||||
(long unsigned int) MSTP_Statistics[i].tusage_timeout);
|
||||
fprintf(stdout,
|
||||
"\t%lu\t%lu\t%lu",
|
||||
fprintf(stdout, "\t%lu\t%lu\t%lu",
|
||||
(long unsigned int) MSTP_Statistics[i].pfm_reply,
|
||||
(long unsigned int) MSTP_Statistics[i].der_reply,
|
||||
(long unsigned int) MSTP_Statistics[i].reply_postponed);
|
||||
@@ -221,7 +218,8 @@ static void packet_statistics_save(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void packet_statistics_clear(void)
|
||||
static void packet_statistics_clear(
|
||||
void)
|
||||
{
|
||||
unsigned i; /* loop counter */
|
||||
|
||||
@@ -391,7 +389,8 @@ static void cleanup(
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
static BOOL WINAPI CtrlCHandler(DWORD dwCtrlType)
|
||||
static BOOL WINAPI CtrlCHandler(
|
||||
DWORD dwCtrlType)
|
||||
{
|
||||
dwCtrlType = dwCtrlType;
|
||||
exit(0);
|
||||
@@ -472,9 +471,7 @@ int main(
|
||||
RS485_Interface(), (long) RS485_Get_Baud_Rate());
|
||||
atexit(cleanup);
|
||||
#if defined(_WIN32)
|
||||
SetConsoleMode(
|
||||
GetStdHandle(STD_INPUT_HANDLE),
|
||||
ENABLE_PROCESSED_INPUT);
|
||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT);
|
||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlCHandler, TRUE);
|
||||
#else
|
||||
signal_init();
|
||||
|
||||
@@ -175,7 +175,8 @@ int Analog_Input_Encode_Property_APDU(
|
||||
encode_application_enumerated(&apdu[0], OBJECT_ANALOG_INPUT);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
apdu_len = encode_application_real(&apdu[0],
|
||||
apdu_len =
|
||||
encode_application_real(&apdu[0],
|
||||
Analog_Input_Present_Value(object_instance));
|
||||
break;
|
||||
case PROP_STATUS_FLAGS:
|
||||
|
||||
@@ -377,10 +377,8 @@ bool Analog_Value_Write_Property(
|
||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||
algorithm and may not be used for other purposes in any
|
||||
object. */
|
||||
if (Analog_Value_Present_Value_Set(
|
||||
wp_data->object_instance,
|
||||
value.type.Real,
|
||||
wp_data->priority)) {
|
||||
if (Analog_Value_Present_Value_Set(wp_data->object_instance,
|
||||
value.type.Real, wp_data->priority)) {
|
||||
status = true;
|
||||
} else if (wp_data->priority == 6) {
|
||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||
|
||||
@@ -67,7 +67,10 @@ static void Init_Service_Handlers(
|
||||
handler_read_property);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
char *value_string = NULL;
|
||||
bool status = false;
|
||||
BACNET_COV_DATA cov_data;
|
||||
|
||||
@@ -67,7 +67,8 @@ void MyAbortHandler(
|
||||
(void) src;
|
||||
(void) invoke_id;
|
||||
(void) server;
|
||||
fprintf(stderr,"BACnet Abort: %s\r\n", bactext_abort_reason_name(abort_reason));
|
||||
fprintf(stderr, "BACnet Abort: %s\r\n",
|
||||
bactext_abort_reason_name(abort_reason));
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
@@ -79,7 +80,8 @@ void MyRejectHandler(
|
||||
/* FIXME: verify src and invoke id */
|
||||
(void) src;
|
||||
(void) invoke_id;
|
||||
fprintf(stderr, "BACnet Reject: %s\r\n", bactext_reject_reason_name(reject_reason));
|
||||
fprintf(stderr, "BACnet Reject: %s\r\n",
|
||||
bactext_reject_reason_name(reject_reason));
|
||||
Error_Detected = true;
|
||||
}
|
||||
|
||||
@@ -111,14 +113,16 @@ static void print_address_cache(
|
||||
unsigned max_apdu = 0;
|
||||
|
||||
/* printf("%-7s %-14s %-4s %-5s %-14s\n", "Device", "MAC", "APDU", "SNET", "SADR"); */
|
||||
printf(";%-7s %-17s %-5s %-17s %-4s\n", "Device", "MAC", "SNET", "SADR", "APDU");
|
||||
printf(";%-7s %-17s %-5s %-17s %-4s\n", "Device", "MAC", "SNET", "SADR",
|
||||
"APDU");
|
||||
printf(";------- ----------------- ----- ----------------- ----\n");
|
||||
for (i = 0; i < MAX_ADDRESS_CACHE; i++) {
|
||||
if (address_get_by_index(i, &device_id, &max_apdu, &address)) {
|
||||
printf(" %-7u ", device_id);
|
||||
for (j = 0; j < MAX_MAC_LEN; j++) {
|
||||
if (j < address.mac_len) {
|
||||
if(j > 0) printf(":");
|
||||
if (j > 0)
|
||||
printf(":");
|
||||
printf("%02X", address.mac[j]);
|
||||
} else {
|
||||
printf(" ");
|
||||
@@ -128,7 +132,8 @@ static void print_address_cache(
|
||||
if (address.net) {
|
||||
for (j = 0; j < MAX_MAC_LEN; j++) {
|
||||
if (j < address.len) {
|
||||
if(j > 0) printf(":");
|
||||
if (j > 0)
|
||||
printf(":");
|
||||
printf("%02X", address.adr[j]);
|
||||
} else {
|
||||
printf(" ");
|
||||
|
||||
@@ -219,5 +219,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,12 +55,13 @@ ISR(ADC_vect)
|
||||
}
|
||||
|
||||
uint8_t adc_result(
|
||||
uint8_t channel) /* 0..7 = ADC0..ADC7, respectively */
|
||||
{
|
||||
uint8_t channel)
|
||||
{ /* 0..7 = ADC0..ADC7, respectively */
|
||||
return Sample_Result;
|
||||
}
|
||||
|
||||
void adc_init(void)
|
||||
void adc_init(
|
||||
void)
|
||||
{
|
||||
/* set prescaler */
|
||||
ADCSRA |= ADPS_8BIT;
|
||||
|
||||
@@ -30,11 +30,12 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
uint8_t adc_result(uint8_t channel);
|
||||
void adc_init(void);
|
||||
uint8_t adc_result(
|
||||
uint8_t channel);
|
||||
void adc_init(
|
||||
void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -346,10 +346,8 @@ bool Analog_Value_Write_Property(
|
||||
switch (wp_data->object_property) {
|
||||
case PROP_PRESENT_VALUE:
|
||||
if (value.tag == BACNET_APPLICATION_TAG_REAL) {
|
||||
if (Analog_Value_Present_Value_Set(
|
||||
wp_data->object_instance,
|
||||
value.type.Real,
|
||||
wp_data->priority)) {
|
||||
if (Analog_Value_Present_Value_Set(wp_data->object_instance,
|
||||
value.type.Real, wp_data->priority)) {
|
||||
status = true;
|
||||
} else if (wp_data->priority == 6) {
|
||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||
@@ -363,10 +361,8 @@ bool Analog_Value_Write_Property(
|
||||
}
|
||||
#if 0
|
||||
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
|
||||
if (Analog_Value_Present_Value_Set(
|
||||
wp_data->object_instance,
|
||||
NAN,
|
||||
wp_data->priority)) {
|
||||
if (Analog_Value_Present_Value_Set(wp_data->object_instance,
|
||||
NAN, wp_data->priority)) {
|
||||
status = true;
|
||||
} else {
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
|
||||
@@ -33,7 +33,6 @@ FUSES = {
|
||||
/* note: fuses are enabled by clearing the bit, so
|
||||
any fuses listed below are cleared fuses. */
|
||||
.low = (FUSE_CKSEL3 & FUSE_SUT0 & FUSE_SUT1),
|
||||
|
||||
/* BOOTSZ configuration:
|
||||
BOOTSZ1 BOOTSZ0 Boot Size
|
||||
------- ------- ---------
|
||||
|
||||
@@ -34,7 +34,8 @@ static uint8_t Buttons;
|
||||
|
||||
#if BDK_V1_HACK
|
||||
/* version 1 BDK workaournd for floating inputs */
|
||||
static void input_switch_workaround(void)
|
||||
static void input_switch_workaround(
|
||||
void)
|
||||
{
|
||||
/* configure the port pins for the switch - as outputs */
|
||||
BIT_SET(DDRA, DDA0);
|
||||
|
||||
@@ -162,7 +162,8 @@ void idle_task(
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
void test_init(void)
|
||||
void test_init(
|
||||
void)
|
||||
{
|
||||
timer_reset(TIMER_LED_3);
|
||||
timer_reset(TIMER_LED_4);
|
||||
|
||||
@@ -117,7 +117,8 @@ void serial_byte_send(
|
||||
return;
|
||||
}
|
||||
|
||||
void serial_byte_transmit_complete(void)
|
||||
void serial_byte_transmit_complete(
|
||||
void)
|
||||
{
|
||||
/* was the frame sent? */
|
||||
while (!BIT_CHECK(UCSR1A, TXC1)) {
|
||||
|
||||
@@ -42,7 +42,8 @@ extern "C" {
|
||||
/* byte transmit */
|
||||
void serial_byte_send(
|
||||
uint8_t ch);
|
||||
void serial_byte_transmit_complete(void);
|
||||
void serial_byte_transmit_complete(
|
||||
void);
|
||||
|
||||
uint32_t serial_baud_rate(
|
||||
void);
|
||||
|
||||
@@ -33,15 +33,17 @@ static volatile uint32_t Millisecond_Counter[MAX_MILLISECOND_TIMERS];
|
||||
|
||||
/* start time for the clock */
|
||||
static struct timespec start;
|
||||
uint32_t timeGetTime(void)
|
||||
uint32_t timeGetTime(
|
||||
void)
|
||||
{
|
||||
struct timespec now;
|
||||
uint32_t ticks;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
ticks = (now.tv_sec-start.tv_sec)*1000+
|
||||
(now.tv_nsec-start.tv_nsec)/1000000;
|
||||
ticks =
|
||||
(now.tv_sec - start.tv_sec) * 1000 + (now.tv_nsec -
|
||||
start.tv_nsec) / 1000000;
|
||||
|
||||
return ticks;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
uint32_t timeGetTime(void);
|
||||
uint32_t timeGetTime(
|
||||
void);
|
||||
|
||||
void timer_init(
|
||||
void);
|
||||
|
||||
@@ -661,7 +661,8 @@ bool dlmstp_init(
|
||||
if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR) {
|
||||
fprintf(stderr, "Failed to set timer resolution\n");
|
||||
}
|
||||
TimeBeginPeriod = min(max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax);
|
||||
TimeBeginPeriod =
|
||||
min(max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax);
|
||||
timeBeginPeriod(TimeBeginPeriod);
|
||||
|
||||
/* start the threads */
|
||||
|
||||
@@ -141,8 +141,7 @@ int alarm_ack_decode_service_request(
|
||||
len += section_len;
|
||||
|
||||
if (-1 == (section_len =
|
||||
decode_context_enumerated(&apdu[len], 2,
|
||||
&enumValue))) {
|
||||
decode_context_enumerated(&apdu[len], 2, &enumValue))) {
|
||||
return -1;
|
||||
}
|
||||
data->eventTypeAcked = (BACNET_EVENT_TYPE) enumValue;
|
||||
|
||||
@@ -105,8 +105,7 @@ int bacapp_decode_device_obj_property_ref(
|
||||
apdu_len += len;
|
||||
|
||||
if (-1 == (len =
|
||||
decode_context_enumerated(&apdu[apdu_len], 1,
|
||||
&enumValue))) {
|
||||
decode_context_enumerated(&apdu[apdu_len], 1, &enumValue))) {
|
||||
return -1;
|
||||
}
|
||||
value->propertyIdentifier = (BACNET_PROPERTY_ID) enumValue;
|
||||
|
||||
@@ -175,7 +175,8 @@ int bacapp_decode_property_state(
|
||||
&enumValue))) {
|
||||
return -1;
|
||||
}
|
||||
value->state.lifeSafetyState = (BACNET_LIFE_SAFETY_STATE)enumValue;
|
||||
value->state.lifeSafetyState =
|
||||
(BACNET_LIFE_SAFETY_STATE) enumValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -572,7 +572,8 @@ int cov_subscribe_property_decode_service_request(
|
||||
decode_tag_number_and_value(&apdu[len], &tag_number,
|
||||
&len_value);
|
||||
len += decode_enumerated(&apdu[len], len_value, &property);
|
||||
data->monitoredProperty.propertyIdentifier = (BACNET_PROPERTY_ID)property;
|
||||
data->monitoredProperty.propertyIdentifier =
|
||||
(BACNET_PROPERTY_ID) property;
|
||||
} else
|
||||
return -4;
|
||||
/* the optional array index is tag 1 */
|
||||
|
||||
@@ -776,7 +776,8 @@ int event_notify_decode_service_request(
|
||||
return -1;
|
||||
}
|
||||
data->notificationParams.changeOfLifeSafety.
|
||||
operationExpected = (BACNET_LIFE_SAFETY_OPERATION)value;
|
||||
operationExpected =
|
||||
(BACNET_LIFE_SAFETY_OPERATION) value;
|
||||
len += section_length;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user