mirror of https://github.com/arendst/Tasmota.git
Add command ``Time 4``
Add command ``Time 4`` to display timestamp using milliseconds (#8537)
This commit is contained in:
parent
c333b67669
commit
90d3cd45c4
|
@ -59,6 +59,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||
- Change Energy JSON Total field from ``"Total":[33.736,11.717,16.978]`` to ``"Total":33.736,"TotalTariff":[11.717,16.978]``
|
||||
- Change Energy JSON ExportActive field from ``"ExportActive":[33.736,11.717,16.978]`` to ``"ExportActive":33.736,"ExportTariff":[11.717,16.978]``
|
||||
- Add command ``Rule0`` to change global rule parameters
|
||||
- Add command ``Time 4`` to display timestamp using milliseconds (#8537)
|
||||
- Add commands ``LedPwmOn 0..255``, ``LedPwmOff 0..255`` and ``LedPwmMode1 0/1`` to control led brightness by George (#8491)
|
||||
- Add more functionality to ``Switchmode`` 11 and 12 (#8450)
|
||||
- Add wildcard pattern ``?`` for JSON matching in rules
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
- Change Energy JSON Total field from ``"Total":[33.736,11.717,16.978]`` to ``"Total":33.736,"TotalTariff":[11.717,16.978]``
|
||||
- Change Energy JSON ExportActive field from ``"ExportActive":[33.736,11.717,16.978]`` to ``"ExportActive":33.736,"ExportTariff":[11.717,16.978]``
|
||||
- Change Adafruit_SGP30 library from v1.0.3 to v1.2.0 (#8519)
|
||||
- Add Three Phase Export Active Energy to SDM630 driver
|
||||
- Add command ``Time 4`` to display timestamp using milliseconds (#8537)
|
||||
- Add commands ``LedPwmOn 0..255``, ``LedPwmOff 0..255`` and ``LedPwmMode1 0/1`` to control led brightness by George (#8491)
|
||||
- Add Three Phase Export Active Energy to SDM630 driver
|
||||
- Add wildcard pattern ``?`` for JSON matching in rules
|
||||
|
||||
### 8.3.1.1 20200518
|
||||
|
|
|
@ -996,6 +996,9 @@ char* ResponseGetTime(uint32_t format, char* time_str)
|
|||
case 2:
|
||||
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":%u"), UtcTime());
|
||||
break;
|
||||
case 3:
|
||||
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s.%d\""), GetDateAndTime(DT_LOCAL).c_str(), RtcMillis());
|
||||
break;
|
||||
default:
|
||||
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str());
|
||||
}
|
||||
|
|
|
@ -1641,12 +1641,12 @@ void CmndTime(void)
|
|||
// payload 1 = Time format {"Time":"2019-09-04T14:31:29"}
|
||||
// payload 2 = Time format {"Time":"2019-09-04T14:31:29","Epoch":1567600289}
|
||||
// payload 3 = Time format {"Time":1567600289}
|
||||
// payload 4 = reserved
|
||||
// payload 4 = Time format {"Time":"2019-09-04T14:31:29.123"}
|
||||
// payload 1451602800 - disable NTP and set time to epoch
|
||||
|
||||
uint32_t format = Settings.flag2.time_format;
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 4)) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 5)) {
|
||||
Settings.flag2.time_format = XdrvMailbox.payload -1;
|
||||
format = Settings.flag2.time_format;
|
||||
} else {
|
||||
|
|
|
@ -47,6 +47,7 @@ struct RTC {
|
|||
uint32_t ntp_time = 0;
|
||||
uint32_t midnight = 0;
|
||||
uint32_t restart_time = 0;
|
||||
uint32_t millis = 0;
|
||||
int32_t time_timezone = 0;
|
||||
uint8_t ntp_sync_minute = 0;
|
||||
bool midnight_now = false;
|
||||
|
@ -239,6 +240,10 @@ uint32_t MinutesPastMidnight(void)
|
|||
return minutes;
|
||||
}
|
||||
|
||||
uint32_t RtcMillis(void) {
|
||||
return (millis() - Rtc.millis) % 1000;
|
||||
}
|
||||
|
||||
void BreakTime(uint32_t time_input, TIME_T &tm)
|
||||
{
|
||||
// break the given time_input into time components
|
||||
|
@ -362,6 +367,8 @@ void RtcSecond(void)
|
|||
{
|
||||
TIME_T tmpTime;
|
||||
|
||||
Rtc.millis = millis();
|
||||
|
||||
if (!Rtc.user_time_entry && !global_state.wifi_down) {
|
||||
uint8_t uptime_minute = (uptime / 60) % 60; // 0 .. 59
|
||||
if ((Rtc.ntp_sync_minute > 59) && (uptime_minute > 2)) {
|
||||
|
|
Loading…
Reference in New Issue