diff options
| author | Mirta <mirta@twine-s.com> | 2020-11-23 16:13:53 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-11-23 16:13:53 +0200 |
| commit | 91c007adced573e09b77ab4be4a5aba623a816cc (patch) | |
| tree | 250221fc2def7d59f1393be8394f766faf576656 /Software/Embedded_SW/Embedded/Communication | |
| parent | 4e9af2b852eb3b9eecfa09e9bc76869558e183cb (diff) | |
| parent | 50a3c0b857b4aa88a9e3970d69256f12b5b24eb8 (diff) | |
| download | Tango-91c007adced573e09b77ab4be4a5aba623a816cc.tar.gz Tango-91c007adced573e09b77ab4be4a5aba623a816cc.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Communication')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Communication/Connection.c | 21 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Communication/Connection.h | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c index af60541aa..5396938fd 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.c +++ b/Software/Embedded_SW/Embedded/Communication/Connection.c @@ -53,9 +53,25 @@ void StopRecurringReports(void) PowerUpStopReporting(); MachineUpdateStopReporting(); PowerDownStopReporting(); + HomingStopReporting(); KeepAliveActive = false; } +struct tm LocalTime;//Months since January - [0,11] + +TimeAScii LocalTimeInAScii; + +void LocalTimeToAScii()//'D''D''/''M''M''/''Y''Y' Nedded for RFID +{ + LocalTimeInAScii.Byte.YearL = '0' + LocalTime.tm_year%10; + LocalTimeInAScii.Byte.YearH = '0' + (LocalTime.tm_year/10)%10; + LocalTimeInAScii.Byte.SlashM = '/'; + LocalTimeInAScii.Byte.MonthL = '0' + (LocalTime.tm_mon)%10; + LocalTimeInAScii.Byte.MonthH = '0' + ((LocalTime.tm_mon)/10)%10; + LocalTimeInAScii.Byte.SlashD = '/'; + LocalTimeInAScii.Byte.DayL = '0' + LocalTime.tm_mday%10; + LocalTimeInAScii.Byte.DayH = '0' + (LocalTime.tm_mday/10)%10; +} void ConnectionRequest(MessageContainer* requestContainer) { MessageContainer responseContainer; @@ -83,6 +99,10 @@ void ConnectionRequest(MessageContainer* requestContainer) if (request->has_unixtime) utilsUpdateDateTime(request->unixtime);//(request->seconds); + ulocaltime(request->unixtime, &LocalTime); + LocalTime.tm_mon +=1;//since we get from ulocaltime Months since January - [0,11] + + LocalTimeToAScii(); StopRecurringReports(); /* extern TangoVersion_t _gTangoVersion; @@ -140,6 +160,7 @@ void DisconnectionRequest(MessageContainer* requestContainer) DiagnosticsStop(); JobStopReporting(); AlarmHandlingStop(); + HomingStopReporting(); //UART_ResetBuffers(); //------------------------------------------------------------------------------------------- uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.h b/Software/Embedded_SW/Embedded/Communication/Connection.h index c0a31344f..c4f8c1df2 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.h +++ b/Software/Embedded_SW/Embedded/Communication/Connection.h @@ -9,6 +9,8 @@ #ifndef COMMUNICATION_CONNECTION_H_ #define COMMUNICATION_CONNECTION_H_ +extern TimeAScii LocalTimeInAScii; + void ConnectionRequest(MessageContainer* requestContainer); void DisconnectionRequest(MessageContainer* requestContainer); void KeepAliveRequestFunc(MessageContainer* requestContainer); @@ -17,5 +19,7 @@ void KeepAliveOneSecondCall(void); extern int KeepAliveOneSecondCounter; extern bool keepalivetest; +extern struct tm LocalTime; +extern TimeAScii LocalTimeInAScii; #endif /* COMMUNICATION_CONNECTION_H_ */ |
