projects
/
revag-nm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More limp home handling
[revag-nm.git]
/
vw-nm.c
diff --git
a/vw-nm.c
b/vw-nm.c
index e656e6847224c325845647d7792834684a9ed7c9..5afa9612738d6da7cb23bb10f9bfdce717e767e1 100644
(file)
--- a/
vw-nm.c
+++ b/
vw-nm.c
@@
-65,6
+65,15
@@
static void nm_update_my_next_id(struct NM_Main *nm) {
break;
}
} while (id != nm->my_id);
break;
}
} while (id != nm->my_id);
+
+ if (nm->nodes[nm->my_id].next == nm->my_id) {
+ /* Uh oh, we're the only one left. */
+
+ /* TODO */
+ nm->nodes[nm->my_id].state = NM_MAIN_LOGIN;
+
+ /* TODO: Timeout 140ms (RCD 310) */
+ }
}
}
@@
-142,7
+151,7
@@
static void nm_handle_can_frame(struct NM_Main *nm, struct can_frame *frame)
* connectivity.
*/
nm->tv.tv_sec = 0;
* connectivity.
*/
nm->tv.tv_sec = 0;
- nm->tv.tv_usec = NM_USECS_
OTHER_TURN
;
+ nm->tv.tv_usec = NM_USECS_
NODE_AWOL
;
}
break;
case NM_MAIN_LOGIN:
}
break;
case NM_MAIN_LOGIN:
@@
-163,9
+172,11
@@
static void nm_handle_can_frame(struct NM_Main *nm, struct can_frame *frame)
*/
if (next != sender) {
nm->tv.tv_sec = 0;
*/
if (next != sender) {
nm->tv.tv_sec = 0;
- nm->tv.tv_usec = NM_USECS_
OTHER_TURN
;
+ nm->tv.tv_usec = NM_USECS_
NODE_AWOL
;
}
break;
}
break;
+ case NM_MAIN_LIMPHOME:
+ nm_update_my_next_id(nm);
}
nm_dump_all(nm);
}
nm_dump_all(nm);
@@
-190,7
+201,7
@@
static void nm_buildframe(struct NM_Main *nm, struct can_frame *frame)
static void nm_timeout_callback(struct NM_Main *nm, struct can_frame *frame)
{
nm->tv.tv_sec = 0;
static void nm_timeout_callback(struct NM_Main *nm, struct can_frame *frame)
{
nm->tv.tv_sec = 0;
- nm->tv.tv_usec = NM_USECS_
OTHER_TURN
;
+ nm->tv.tv_usec = NM_USECS_
NODE_AWOL
;
nm_buildframe(nm, frame);
}
nm_buildframe(nm, frame);
}