|
@@ -8,10 +8,10 @@
|
|
|
#include "log.h"
|
|
|
#include "settings_api.h"
|
|
|
#include "common_config.h"
|
|
|
+#include "swap.h"
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
-
|
|
|
mb_param_t mb_param[MB_PARAM_MAX];
|
|
|
|
|
|
uint32_t rtc_sinhro;
|
|
@@ -22,13 +22,14 @@ bool psw_ok = false;
|
|
|
uint8_t fw_version[8];
|
|
|
uint16_t save_sys_cmd = 0;
|
|
|
uint16_t system_cmd = 0;
|
|
|
+uint64_t value_64 = 0;
|
|
|
|
|
|
void get_time(uint8_t* buf, uint8_t size);
|
|
|
void get_din_mode(uint8_t* buf, uint8_t size);
|
|
|
|
|
|
void get_log_entries_number(uint8_t* buf, uint8_t size);
|
|
|
void get_archive_entries_number(uint8_t* buf, uint8_t size);
|
|
|
-
|
|
|
+void get_rtc(uint8_t* buf, uint8_t size);
|
|
|
|
|
|
|
|
|
|
|
@@ -201,6 +202,26 @@ void mb_init_params(void)
|
|
|
|
|
|
index++;
|
|
|
|
|
|
+
|
|
|
+ mb_param[index].reg = 0x0801;
|
|
|
+ mb_param[index].size = 2;
|
|
|
+ mb_param[index].param = (uint8_t*)&uptime;
|
|
|
+ mb_param[index].set = NULL;
|
|
|
+ mb_param[index].get = NULL;
|
|
|
+ mb_param[index].check_handler = mb_check_dummy;
|
|
|
+
|
|
|
+ index++;
|
|
|
+
|
|
|
+
|
|
|
+ mb_param[index].reg = 0x0803;
|
|
|
+ mb_param[index].size = 4;
|
|
|
+ mb_param[index].param = (uint8_t*)&value_64;
|
|
|
+ mb_param[index].set = mb_set_rtc;
|
|
|
+ mb_param[index].get = get_rtc;
|
|
|
+ mb_param[index].check_handler = mb_check_dummy;
|
|
|
+
|
|
|
+ index++;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -412,6 +433,7 @@ void mb_get_param(uint8_t *buf, uint16_t index)
|
|
|
|
|
|
|
|
|
|
|
|
+#if 0
|
|
|
void get_time(uint8_t* buf, uint8_t size)
|
|
|
{
|
|
|
uint32_t rtc_unix = RTC_GetUnixTime();
|
|
@@ -424,6 +446,9 @@ void get_time(uint8_t* buf, uint8_t size)
|
|
|
ptr--;
|
|
|
}
|
|
|
}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
void get_din_mode(uint8_t* buf, uint8_t size)
|
|
@@ -434,17 +459,30 @@ void get_din_mode(uint8_t* buf, uint8_t size)
|
|
|
|
|
|
void get_log_entries_number(uint8_t* buf, uint8_t size)
|
|
|
{
|
|
|
- uint16_t capacity = log_capacity();
|
|
|
- SWAP_16(buf, capacity);
|
|
|
+ static uint16_t capacity;
|
|
|
+
|
|
|
+ capacity = swap_uint16(log_capacity());
|
|
|
+
|
|
|
+ buf = (uint8_t*)&capacity;
|
|
|
}
|
|
|
|
|
|
|
|
|
void get_archive_entries_number(uint8_t* buf, uint8_t size)
|
|
|
{
|
|
|
- uint16_t capacity = log_arch_capacity();
|
|
|
- SWAP_16(buf, capacity);
|
|
|
+ static uint16_t capacity;
|
|
|
+
|
|
|
+ capacity = swap_uint16(log_arch_capacity());
|
|
|
+
|
|
|
+ buf = (uint8_t*)&capacity;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+void get_rtc(uint8_t* buf, uint8_t size)
|
|
|
+{
|
|
|
+ uint64_t rtc = swap_uint64(rtc_get_ms());
|
|
|
+
|
|
|
+ memcpy(buf, &rtc, 8);
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
@@ -526,6 +564,13 @@ mb_delay_action_t mb_control(void)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+mb_delay_action_t mb_set_rtc(void)
|
|
|
+{
|
|
|
+ rtc_set_in_ms((uint32_t)(value_64/1000));
|
|
|
+ return MB_NO_ACTION;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
|