16-bit values of seconds only go up to 18 hours, and sometimes a little
more than that would be nice.
32 is overkill. 24 would have been fine, but would have been slightly
annoying to encode and parse.
* etc.
* This provides some robustness against network outages, automatically
* replaying the log periodically to be collected after connectivity
* etc.
* This provides some robustness against network outages, automatically
* replaying the log periodically to be collected after connectivity
- * is restored.
- *
- * Values above 17 are currently not recommended because the current
- * wire format uses a 16-bit field for a duration in seconds, which wraps
- * at 18 hours.
- * */
const uint config_resend_count = 16;
/* These control the size of the per-send-count press queues.
const uint config_resend_count = 16;
/* These control the size of the per-send-count press queues.
* etc.
* This provides some robustness against network outages, automatically
* replaying the log periodically to be collected after connectivity
* etc.
* This provides some robustness against network outages, automatically
* replaying the log periodically to be collected after connectivity
- * is restored.
- *
- * Values above 17 are currently not recommended because the current
- * wire format uses a 16-bit field for a duration in seconds, which wraps
- * at 18 hours.
- * */
extern const uint config_resend_count;
/* These control the size of the per-send-count press queues.
extern const uint config_resend_count;
/* These control the size of the per-send-count press queues.
struct tattle_message_wire_format {
u16_t sender;
u16_t seq;
struct tattle_message_wire_format {
u16_t sender;
u16_t seq;
-void send_report_packet(u16_t seq, u16_t ago) {
+void send_report_packet(u16_t seq, u32_t ago) {
cyw43_arch_lwip_begin();
initialize_the_pcb();
cyw43_arch_lwip_begin();
initialize_the_pcb();
(struct tattle_message_wire_format *)(p->payload);
msg->sender = htons(config_this_tattler_identity);
msg->seq = htons(seq);
(struct tattle_message_wire_format *)(p->payload);
msg->sender = htons(config_this_tattler_identity);
msg->seq = htons(seq);
if (udp_send(the_pcb, p) != ERR_OK)
signal_error_by_blinking();
if (udp_send(the_pcb, p) != ERR_OK)
signal_error_by_blinking();
-void send_report_packet(u16_t seq, u16_t ago);
+void send_report_packet(u16_t seq, u32_t ago);
press_t press;
if (!get_press_due_for_resend(pp, now, &press))
signal_error_by_blinking();
press_t press;
if (!get_press_due_for_resend(pp, now, &press))
signal_error_by_blinking();
- uint32_t ago = now - press.timestamp;
+ u32_t ago = now - press.timestamp;
send_report_packet(press.seq, ago);
press.send_count++;
if (press.send_count < config_resend_count) {
send_report_packet(press.seq, ago);
press.send_count++;
if (press.send_count < config_resend_count) {