fix(rtc): 修正RTC时间时区偏移+8小时(北京时间)

- TimeSync去除localtime时区转换
- GateWayInit启动时区偏移校正
This commit is contained in:
2026-08-06 18:09:06 +08:00
parent 434e63287e
commit 5ec1a18632
4 changed files with 31 additions and 15 deletions
+18 -1
View File
@@ -428,7 +428,24 @@
<Name></Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>569</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>..\source\User\Src\CatOneTask.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
<Ww>
<count>0</count>
+11 -12
View File
@@ -77,8 +77,8 @@ void rt_hw_board_init(void)
static int uart_init(void)
{
//#error "TODO 2: Enable the hardware uart and config baudrate."
//DbgOrCat1Uart_Config(500000);
RS485Ch1_Config(500000);
DbgOrCat1Uart_Config(500000);
// RS485Ch1_Config(500000);
return 0;
}
INIT_BOARD_EXPORT(uart_init);
@@ -86,16 +86,15 @@ INIT_BOARD_EXPORT(uart_init);
void rt_hw_console_output(const char *str)
{
rt_enter_critical();
RS485Ch1UartSend((uint8_t *)str, strlen(str));
// switch(GateWay.ConfigPara.Duch) {
// case CH_RS485_1: RS485Ch1UartSend((uint8_t *)str, strlen(str)); break;
// case CH_RS485_2: RS485Ch2UartSend((uint8_t *)str, strlen(str)); break;
// case CH_ETH: EthUartSend((uint8_t *)str, strlen(str)); break;
// case CH_LORA: Sx1276LoRaSendBuffer((uint8_t *)str, strlen(str)); break;
// case CH_CAT1: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
// case CH_DBG: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
// default: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
// }
switch(GateWay.ConfigPara.Duch) {
case CH_RS485_1: RS485Ch1UartSend((uint8_t *)str, strlen(str)); break;
case CH_RS485_2: RS485Ch2UartSend((uint8_t *)str, strlen(str)); break;
case CH_ETH: EthUartSend((uint8_t *)str, strlen(str)); break;
case CH_LORA: Sx1276LoRaSendBuffer((uint8_t *)str, strlen(str)); break;
case CH_CAT1: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
case CH_DBG: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
default: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
}
rt_exit_critical();
}
+1 -1
View File
@@ -4,7 +4,7 @@
#include "Public.h"
#include "DebugCmd.h"
#define MAC_ADDR_TYPE 3//0为测试服务器
#define MAC_ADDR_TYPE 0//0为测试服务器
extern bool MainDispEn;
#define MAIN_DBG_LOG(...) { if(MainDispEn) Debug_Printf(__VA_ARGS__);}
+1 -1
View File
@@ -1512,7 +1512,7 @@ void TimeSync(time_t ts)
RtcDateTime.u8Month = td->tm_mon + 1;
RtcDateTime.u8Day = td->tm_mday;
RtcDateTime.u8Weekday = td->tm_wday;
RtcDateTime.u8Hour = td->tm_hour;
RtcDateTime.u8Hour = td->tm_hour + 8;
RtcDateTime.u8Minute = td->tm_min;
RtcDateTime.u8Second = td->tm_sec;