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--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP133F.tmp" with contents +Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP606.tmp" with contents [ /nologo /MLd /W3 /Gm /GX /ZI /Od /I "..\..\.." /I ".." /I "..\..\..\demo\object\\" /I "..\..\..\demo\handler\\" /D "_DEBUG" /D BACDL_BIP=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D TSM_ENABLED=1 /D PRINT_ENABLED=1 /D BIG_ENDIAN=0 /D USE_INADDR=0 /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c "C:\code\bacnet-stack\abort.c" @@ -29,7 +29,6 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP133F.tmp" with conte "C:\code\bacnet-stack\demo\object\bo.c" "C:\code\bacnet-stack\demo\object\bv.c" "C:\code\bacnet-stack\crc.c" -"C:\code\bacnet-stack\datalink.c" "C:\code\bacnet-stack\dcc.c" "C:\code\bacnet-stack\demo\object\device.c" "C:\code\bacnet-stack\demo\handler\h_arf.c" @@ -56,9 +55,11 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP133F.tmp" with conte "C:\code\bacnet-stack\demo\handler\txbuf.c" "C:\code\bacnet-stack\whois.c" "C:\code\bacnet-stack\wp.c" +"C:\code\bacnet-stack\demo\object\lc.c" +"C:\code\bacnet-stack\datetime.c" ] -Creating command line "cl.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP133F.tmp" -Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP1340.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP606.tmp" +Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP607.tmp" with contents [ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/bacnet.pdb" /debug /machine:I386 /out:"Debug/bacnet.exe" /pdbtype:sept ".\Debug\abort.obj" @@ -81,7 +82,6 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32 ".\Debug\bo.obj" ".\Debug\bv.obj" ".\Debug\crc.obj" -".\Debug\datalink.obj" ".\Debug\dcc.obj" ".\Debug\device.obj" ".\Debug\h_arf.obj" @@ -108,8 +108,10 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32 ".\Debug\txbuf.obj" ".\Debug\whois.obj" ".\Debug\wp.obj" +".\Debug\lc.obj" +".\Debug\datetime.obj" ] -Creating command line "link.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP1340.tmp" +Creating command line "link.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP607.tmp"

Output Window

Compiling... abort.c @@ -134,7 +136,6 @@ bv.c crc.c Generating Code... Compiling... -datalink.c dcc.c device.c h_arf.c @@ -154,18 +155,20 @@ npdu.c reject.c ringbuf.c rp.c +s_rp.c Generating Code... Compiling... -s_rp.c s_whois.c s_wp.c tsm.c txbuf.c whois.c wp.c +lc.c +datetime.c Generating Code... Linking... -Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP1342.tmp" with contents +Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP609.tmp" with contents [ /nologo /o"Debug/bacnet.bsc" ".\Debug\abort.sbr" @@ -188,7 +191,6 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP1342.tmp" with conte ".\Debug\bo.sbr" ".\Debug\bv.sbr" ".\Debug\crc.sbr" -".\Debug\datalink.sbr" ".\Debug\dcc.sbr" ".\Debug\device.sbr" ".\Debug\h_arf.sbr" @@ -214,8 +216,10 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP1342.tmp" with conte ".\Debug\tsm.sbr" ".\Debug\txbuf.sbr" ".\Debug\whois.sbr" -".\Debug\wp.sbr"] -Creating command line "bscmake.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP1342.tmp" +".\Debug\wp.sbr" +".\Debug\lc.sbr" +".\Debug\datetime.sbr"] +Creating command line "bscmake.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP609.tmp" Creating browse info file...

Output Window