-
Notifications
You must be signed in to change notification settings - Fork 3k
Add get_time function to ESP8266 #12300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d48ba7b
to
aeb288d
Compare
I pushed astyle fixes. |
There will be a bunch of chrono changes coming soon, but at the minute I'm only considering the kernel millisecond clocks and the HAL ticker_api clocks, not the RTC/wall-clock time. (I'm doing them as local So at the minute, I'd be inclined to stick with the traditional
Well, that's not necessary, you can use |
I think this PR doesn't need any work, does it? |
We need a function returning 'seconds' rather than a 'ctime' format timestamp (unless I've missed something here). |
@star297 , I personally think it is better to return |
Yes, from the 'device' output point, I agree that would better. |
Any reason why debug is now always disabled in ESP8266Interface.cpp? There is no mention of it in summary of changes |
aeb288d
to
ce6b99f
Compare
Good point, @AnttiKauppila . I was just reluctant to modify the json file (which causes full rebuild of the code) and only modified the flags locally when checking if things work fine without logs. Then I forgot to remove this temporary solution. It should be fine now. |
Can you please re-think your API. I cannot find any relation between IEEE 802.11 WiFi networks and RFC 5905 Network Time protocol. Even if some modules do support it, this should not bubble up to the public API as part of "network interface" Original design is that If you insist that |
That is a very good point. |
I see your point, @SeppoTakalo . Indeed @star297 , sounds like this is OK for you, as a reporter, so I'll amend the PR. I will not be able to provide any tests with the PR, though, I hope this is fine? |
ce6b99f
to
9040eb5
Compare
Pull request has been modified.
This is now ready for another review, @SeppoTakalo , @AnttiKauppila |
I am investigating the current failures. For greentea tests - I doubt this is related to my changes, the platform which failed was NUCLEO_F411RE. I tried to rerun, but the job is stuck. |
I could reproduce the |
get_time function allows access to SNTP functionalities of ESP8266
6426afe
to
4cc582c
Compare
Pull request has been modified.
It seems that the ESP8266 chips which are attached to NUCLEO_F411RE's do not have the update firmware (no V1.7 tag) and the SNTP command was only added in v1.5. No SW fix can be made for this and we'd better support older firmware by default. As this is a very optional and experimental feature I just wrapped its usage with a macro, so that it only runs if enabled. This fixed the two failures observed in CI and made the whole PR less intrusive for the code base. Please, review the new changes and run CI again, to check that we're on the safe side. |
CI started meanwhile |
You really shouldn't support ESP8266 below firmware v1.7 |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
@michalpasztamobica We already suggest updating to 1.7 firmware in https://github.com/ARMmbed/mbed-os/tree/master/components/wifi/esp8266-driver#firmware-version Maybe if we just modify the document and suggest that we require at least 1.5 to work but support only 1.7 and newer? |
4cc582c
to
cf2ba1d
Compare
I did as you suggested, @SeppoTakalo . |
CI started |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
Summary of changes
Fixes #12192.
get_time()
function allows access to (S)NTP functionalities of ESP8266 module.I considered using
std::chrono
instead of ctime'sstd::tm
, but then - to convert tochrono::time_point
we'd have to go throughstd::tm
anyway or write our own parser, which I just managed to avoid.Side note: using
std::
introduces some warnings due to-D_LIBCPP_EXTERN_TEMPLATE(...)=
flag being used in all our compilation profiles. This flag seems obsolete and I hope I will get it removed soon.I cannot really add any tests, as they are using
WifiInterface::get_instance()
to get the interface and there is no RTTI, that would allow casting toESP8266Interface
to callget_time()
, but I tested the function locally and it works fine.Impact of changes
None, other than user can check time with ESP8266Interface.
Migration actions required
None
Documentation
Added doxygen functions.
Pull request type
Test results
Reviewers
@AnttiKauppila
@VeijoPesonen
@SeppoTakalo
@kjbracey-arm
@star297