diff --git a/bacnet-stack/datetime.c b/bacnet-stack/datetime.c index 14339c8c..d0e161df 100644 --- a/bacnet-stack/datetime.c +++ b/bacnet-stack/datetime.c @@ -102,12 +102,12 @@ static uint32_t days_since_epoch(uint16_t year, uint8_t month, uint8_t day) static void days_since_epoch_into_ymd(uint32_t days, uint16_t * pYear, uint8_t * pMonth, uint8_t * pDay) { - int year = 1900; - int month = 1; - int day = 1; + uint16_t year = 1900; + uint8_t month = 1; + uint8_t day = 1; while (days >= 365) { - if ((is_leap_year(year)) && days == 365) + if ((is_leap_year(year)) && (days == 365)) break; days -= 365; if (is_leap_year(year)) @@ -120,7 +120,7 @@ static void days_since_epoch_into_ymd(uint32_t days, month++; } - day += days; + day += ((uint8_t)days); if (pYear) *pYear = year; @@ -137,7 +137,7 @@ static void days_since_epoch_into_ymd(uint32_t days, /* wday 1=Monday...7=Sunday */ static uint8_t day_of_week(uint16_t year, uint8_t month, uint8_t day) { - return ((days_since_epoch(year, month, day) % 7) + 1); + return ((uint8_t)(days_since_epoch(year, month, day) % 7) + 1); } /* if the date1 is the same as date2, return is 0 @@ -292,9 +292,9 @@ static void seconds_since_midnight_into_hms(uint32_t seconds, uint8_t hour = 0; uint8_t minute = 0; - hour = seconds / (60 * 60); + hour = (uint8_t)(seconds / (60 * 60)); seconds -= (hour * 60 * 60); - minute = seconds / 60; + minute = (uint8_t)(seconds / 60); seconds -= (minute * 60); if (pHours) @@ -302,7 +302,7 @@ static void seconds_since_midnight_into_hms(uint32_t seconds, if (pMinutes) *pMinutes = minute; if (pSeconds) - *pSeconds = seconds; + *pSeconds = (uint8_t)seconds; } void datetime_add_minutes(BACNET_DATE_TIME * bdatetime, uint32_t minutes) diff --git a/bacnet-stack/demo/object/ao.c b/bacnet-stack/demo/object/ao.c index b36cd5f0..70933440 100644 --- a/bacnet-stack/demo/object/ao.c +++ b/bacnet-stack/demo/object/ao.c @@ -170,7 +170,7 @@ bool Analog_Output_Present_Value_Set( if (priority && (priority <= BACNET_MAX_PRIORITY) && (priority != 6 /* reserved */ ) && (value >= 0.0) && (value <= 100.0)) { - Analog_Output_Level[index][priority] = value; + Analog_Output_Level[index][priority] = (uint8_t)value; /* Note: you could set the physical output here to the next highest priority, or to the relinquish default if no priorities are set. diff --git a/bacnet-stack/demo/object/lc.c b/bacnet-stack/demo/object/lc.c index 676e68fa..15424074 100644 --- a/bacnet-stack/demo/object/lc.c +++ b/bacnet-stack/demo/object/lc.c @@ -254,10 +254,12 @@ struct tm { timer = time(NULL); tblock = localtime(&timer); datetime_set_values(bdatetime, - tblock->tm_year, - tblock->tm_mon, - tblock->tm_mday, - tblock->tm_hour, tblock->tm_min, tblock->tm_sec, 0); + (uint16_t)tblock->tm_year, + (uint8_t)tblock->tm_mon, + (uint8_t)tblock->tm_mday, + (uint8_t)tblock->tm_hour, + (uint8_t)tblock->tm_min, + (uint8_t)tblock->tm_sec, 0); } /* convert the shed level request into an Analog Output Present_Value */ diff --git a/bacnet-stack/ports/win32/bacnet.ide b/bacnet-stack/ports/win32/bacnet.ide index 1b429d97..a00df311 100644 Binary files a/bacnet-stack/ports/win32/bacnet.ide and b/bacnet-stack/ports/win32/bacnet.ide differ diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.dsp b/bacnet-stack/ports/win32/bacnet/bacnet.dsp index 5732a00a..4fb4deee 100644 --- a/bacnet-stack/ports/win32/bacnet/bacnet.dsp +++ b/bacnet-stack/ports/win32/bacnet/bacnet.dsp @@ -169,7 +169,7 @@ SOURCE=..\..\..\crc.c # End Source File # Begin Source File -SOURCE=..\..\..\datalink.c +SOURCE=..\..\..\datetime.c # End Source File # Begin Source File @@ -217,6 +217,14 @@ SOURCE=..\..\..\indtext.c # End Source File # Begin Source File +SOURCE=..\..\..\demo\object\lc.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\object\lc.h +# End Source File +# Begin Source File + SOURCE=..\..\..\demo\object\lsp.c # End Source File # Begin Source File @@ -377,6 +385,10 @@ SOURCE=..\..\..\datalink.h # End Source File # Begin Source File +SOURCE=..\..\..\datetime.h +# End Source File +# Begin Source File + SOURCE=..\..\..\demo\object\device.h # End Source File # Begin Source File diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.ncb b/bacnet-stack/ports/win32/bacnet/bacnet.ncb index 4c36b3fe..c012d256 100644 Binary files a/bacnet-stack/ports/win32/bacnet/bacnet.ncb and b/bacnet-stack/ports/win32/bacnet/bacnet.ncb differ diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.opt b/bacnet-stack/ports/win32/bacnet/bacnet.opt index 3976004f..e3cb378b 100644 Binary files a/bacnet-stack/ports/win32/bacnet/bacnet.opt and b/bacnet-stack/ports/win32/bacnet/bacnet.opt differ diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.plg b/bacnet-stack/ports/win32/bacnet/bacnet.plg index e863066f..e2c7144a 100644 --- a/bacnet-stack/ports/win32/bacnet/bacnet.plg +++ b/bacnet-stack/ports/win32/bacnet/bacnet.plg @@ -6,7 +6,7 @@ --------------------Configuration: bacnet - Win32 Debug--------------------