-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add OTA over mqtt example #3417
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please respect the Makefile standard, that is why tests are failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
279a7ab to
4ff581a
Compare
| // The rpc_ota_update() function handles those requests and calls Mongoose | ||
| // ota_begin(), ota_write(), ota_end() respectively. | ||
| // | ||
| // Visit https://mongoose.ws/mqtt/ web page to push the firmware binary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will stimulate most users to peruse our broker for their personal stuff, I suggest they use a public broker instead, because, besides that, many of our tests rely on this broker.
| MG_INFO(("%lu CONNECTED", c->id)); | ||
| subscribe(c, mg_str(MQTT_RX_TOPIC)); | ||
| } else if (ev == MG_EV_MQTT_MSG) { | ||
| // When we get echo response, print it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover
| static void timer_sntp(void *param) { // SNTP timer function. Sync up time | ||
| static uint64_t hourly_timer = 0; | ||
| uint64_t t1 = mg_now(), t2 = mg_millis(); | ||
| if (t1 < t2 + 3600 || mg_timer_expired(&hourly_timer, 3600000, t2)) { | ||
| mg_sntp_connect(param, "udp://time.google.com:123", NULL, NULL); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This complicates the example, that is already complicated by the use of RPC instead of just going for it.
No description provided.