有api可得知是否使用了2nd boot否?

alexsunmiu
Posts: 41
Joined: Tue May 05, 2015 4:48 pm
Contact:

有api可得知是否使用了2nd boot否?

Postby alexsunmiu » Fri Jun 05, 2015 11:40 pm

如题,system_get_boot_mode和boot ver都不是做这个的,有些场景下,我们的确需要知道当前模块是否使用了2nd boot,譬如ota时,若未使用2nd boot,则拒绝 升级之类的。
another ESP8266 cloud service. https://espush.cn/

alexchang
Posts: 52
Joined: Mon Apr 06, 2015 5:47 pm

Re: 有api可得知是否使用了2nd boot否?

Postby alexchang » Sun Jun 07, 2015 6:45 pm

我也有這個問題,我後來是在編譯 USER1 的時候傳入 -DBIN_USER1,編譯 USER2 的時候傳入 -DBIN_USER2,這樣在程式裡面就可以知道自己是 USER1 還是 USER2 了:
#ifdef BIN_USER1
#endif

#ifdef BIN_USER2
#endif

傳入 -DBIN_USER1 或 -DBIN_USER2 這個寫在 Makefile 就可以了。

alexsunmiu
Posts: 41
Joined: Tue May 05, 2015 4:48 pm
Contact:

Re: 有api可得知是否使用了2nd boot否?

Postby alexsunmiu » Sun Jun 07, 2015 10:27 pm

alexchang wrote:我也有這個問題,我後來是在編譯 USER1 的時候傳入 -DBIN_USER1,編譯 USER2 的時候傳入 -DBIN_USER2,這樣在程式裡面就可以知道自己是 USER1 還是 USER2 了:
#ifdef BIN_USER1
#endif

#ifdef BIN_USER2
#endif

傳入 -DBIN_USER1 或 -DBIN_USER2 這個寫在 Makefile 就可以了。



好主意,thx。
another ESP8266 cloud service. https://espush.cn/

Who is online

Users browsing this forum: No registered users and 117 guests