Skip to content

New SNTP implementation - #683

Merged
victor-Lopez25 merged 13 commits into
developmentfrom
SNTP-new
Sep 27, 2026
Merged

victor-Lopez25 merged 13 commits into
developmentfrom
SNTP-new

Conversation

@victor-Lopez25

Copy link
Copy Markdown
Collaborator

Uses ST-LIB Scheduler instead of Lwip's scheduler.

Will use maximum one Scheduler task.

Example usage:

/* ... */
int main(void) {
    MainBoard::init();

    led_instance = &MainBoard::instance_of<led>();
    auto eth_instance = &MainBoard::instance_of<eth>();

    Scheduler::register_task(200'000, []{ led_instance->toggle(); });

    ST_LIB::SNTP::start("192.168.0.9");

    Scheduler::register_task(1'000'000, []{
        RTCData data = Global_RTC::get_rtc_timestamp();
        INFO("RTC: %u; %uyr %umon %uday %uh %umin %us",
            data.counter, data.year, data.month, data.day,
            data.hour, data.minute, data.second);
    });

    while (1) {
        eth_instance->update();
        Scheduler::update();
        Diagnostics::Hub::flush();
    }
}

Led is not needed but it is to show the board is doing work.

@github-actions

Copy link
Copy Markdown
Contributor

ST-LIB Release Plan

  • Current version: 6.3.1
  • Pending changesets: 1
  • Highest requested bump: minor
  • Next version if merged now: 6.4.0

Pending changes

  • minor Rework SNTP module in ST-LIB to use ST-LIB scheduler instead of Lwip one (.changesets/SNTP-impl.md)

@JavierRibaldelRio JavierRibaldelRio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except the requested changes, from my point of view everything looks fine.
Congratulations @victor-Lopez25

Comment thread Inc/HALAL/Services/Communication/SNTP/SNTP.hpp Outdated
@JavierRibaldelRio JavierRibaldelRio added the enhancement New feature or request label Sep 24, 2026
@JavierRibaldelRio JavierRibaldelRio linked an issue Sep 24, 2026 that may be closed by this pull request
@JavierRibaldelRio

Copy link
Copy Markdown
Member

The code works fine, was tested with me with using an ntp rust-builded server

@victor-Lopez25
victor-Lopez25 merged commit 06c8b93 into development Sep 27, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SNTP

2 participants