Giter Site home page Giter Site logo

Comments (16)

mysterywolf avatar mysterywolf commented on August 27, 2024

你好,新版rt-thread删除NTP部分是因为rtc.c为驱动框架,其只负责提供设置、获取rtc的相关方法,至于是有人来获取/设置还是由机器来获取(NTP)这不是驱动应该负责的问题,因此在最新master中已经从驱动中移除了相关配置,该功能放在了netutils里边。如果你使用最新版的RT-Thread master的话,请使用0.13版本及之后的netutils。该功能不受影响。更新一下你的env,我们前几天刚刚发布了0.1.3.

from netutils.

dongly avatar dongly commented on August 27, 2024

我已经可用0.13版本的netutils了,RTC_SYNC_USING_NTP 这个功能是有的,但没有RTC_SYNC_USING_NTP 这个选项.

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

建议你刷新一下工程以及env,RTC_SYNC_USING_NTP已经删干净了

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

NTP的启动权在netutils这边,直接去nettuils开启NTP就可以看到之前在RTC_SYNC_USING_NTP下的设置了

from netutils.

dongly avatar dongly commented on August 27, 2024

我可能表达得不是很清楚.我是意思是:

  • 我要打开 NTP 功能
  • 但可以选择是否打开 NTP 同步 RTC (即 RTC_SYNC_USING_NTP 选项)

这是的rt-thread V4.03的代码 RTC_SYNC_USING_NTP 选项

#ifdef RTC_SYNC_USING_NTP
static void ntp_sync_thread_enrty(void *param)
{
...
}

int rt_rtc_ntp_sync_init(void)
{
   ...
}
INIT_COMPONENT_EXPORT(rt_rtc_ntp_sync_init);
#endif /* RTC_SYNC_USING_NTP */

而现在的 netutils 对应的这部分没有 RTC_SYNC_USING_NTP 选项

netutils 的 Kconfig 中的 NTP 部分,其中没有 RTC_SYNC_USING_NTP

    config PKG_NETUTILS_NTP
        bool "Enable NTP(Network Time Protocol) client"
        select RT_USING_SAL
        default n
    if PKG_NETUTILS_NTP
        if PKG_NETUTILS_VER_NUM > 0x10200
            config RTC_NTP_FIRST_SYNC_DELAY
                int "NTP first sync delay time(second) for network connect"
                default 30

            config RTC_NTP_SYNC_PERIOD
                int "NTP auto sync period(second)"
                default 3600
        endif

        if PKG_NETUTILS_VER_NUM <= 0x10200
            config NETUTILS_NTP_TIMEZONE
                int "Timezone for calculate local time"
                range -12 12
                default 8
        endif

        config NETUTILS_NTP_HOSTNAME
            string "NTP server name1"
            default "cn.ntp.org.cn"

        config NETUTILS_NTP_HOSTNAME2
            string "NTP server name2"
            default "ntp.rt-thread.org"

        config NETUTILS_NTP_HOSTNAME3
            string "NTP server name3"
            default "edu.ntp.org.cn"
    endif

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

from netutils.

dongly avatar dongly commented on August 27, 2024

是RT-Thread V4.0.4 配 netutils V1.3 无 RTC_SYNC_USING_NTP 选项

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

你现在用的是4.0.4还是4.0.3,我被你搞蒙了。如果你要是4.0.4的话,你需要更新一下你4.0.4的工程源码到最新,估计你工程源码是我改之前的4.0.4源码
你是用的2020年12月发布的4.0.3版本,还是用的master版本,从github上直接download下来的。

from netutils.

dongly avatar dongly commented on August 27, 2024

用的是master版本,配 netutils V1.3

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

更新你的master到最新

from netutils.

dongly avatar dongly commented on August 27, 2024

我的rtt已经更新到最新版(5ba96109c60c4b1a66ff),netutils也更新到了lastest版

项目 RTT V4.03 /netutils V1.2 RTT master/netutils V1.3
ntp_sync_thread_enrty() 代码所在位置 rtt : components\drivers\rtc\rtc.c netutils:ntp/ntp.c
RTC_SYNC_USING_NTP 选项 有,在rtt中的 rtc.c 无(希望加上)

我的希望:

  • netutils/ntp/ntp.c 的404行加入#ifdef RTC_SYNC_USING_NTP
  • netutils/ntp/ntp.c 的441行与442行中间插入#endif /* RTC_SYNC_USING_NTP */
  • netutils 的 Kconfig 加入 RTC_SYNC_USING_NTP ,象原来 RTT 4.03 的一样,现在已master 中删除掉的
//netutils/ntp/ntp.c

#ifdef RTC_SYNC_USING_NTP    // <--- 404行,新插入的
static void ntp_sync_thread_enrty(void *param)
{
    /* first sync delay for network connect */
    rt_thread_delay(RTC_NTP_FIRST_SYNC_DELAY * RT_TICK_PER_SECOND);

    while (1)
    {
        ntp_sync_to_rtc(NULL);
        rt_thread_delay(RTC_NTP_SYNC_PERIOD * RT_TICK_PER_SECOND);
    }
}

static int rt_rtc_ntp_sync_init(void)
{
    static rt_bool_t init_ok = RT_FALSE;
    rt_thread_t thread;

    if (init_ok)
    {
        return 0;
    }

    thread = rt_thread_create("ntp_sync", ntp_sync_thread_enrty, RT_NULL, 1300, RT_THREAD_PRIORITY_MAX - 2, 20);
    if (thread)
    {
        rt_thread_startup(thread);
    }
    else
    {
        return -RT_ENOMEM;
    }

    init_ok = RT_TRUE;

    return RT_EOK;
}
INIT_COMPONENT_EXPORT(rt_rtc_ntp_sync_init);
#endif /* RTC_SYNC_USING_NTP */    // <---新插入的
#endif   //<-- 原 442 行

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

哦 我明白你啥意思了 你是想可以取消自动同步功能 手动同步

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

#63

from netutils.

dongly avatar dongly commented on August 27, 2024

对,谢谢

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

加上了

from netutils.

mysterywolf avatar mysterywolf commented on August 27, 2024

这个issue可以关了

from netutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.