mirror of
https://github.com/schoebel/mars
synced 2024-12-21 22:30:08 +00:00
main: safeguard disconnect from transient bricks
This commit is contained in:
parent
86eb014173
commit
4e928bafc9
@ -5541,8 +5541,25 @@ int _stop_trans(struct mars_rotate *rot)
|
|||||||
write_info_links(rot);
|
write_info_links(rot);
|
||||||
for (i = TL_INPUT_LOG1; i <= TL_INPUT_LOG2; i++) {
|
for (i = TL_INPUT_LOG1; i <= TL_INPUT_LOG2; i++) {
|
||||||
struct trans_logger_input *trans_input;
|
struct trans_logger_input *trans_input;
|
||||||
|
|
||||||
trans_input = trans_brick->inputs[i];
|
trans_input = trans_brick->inputs[i];
|
||||||
if (trans_input && !trans_input->is_operating) {
|
if (trans_input && !trans_input->is_operating) {
|
||||||
|
struct mars_brick *prev_brick;
|
||||||
|
|
||||||
|
if (!trans_input->connect)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* For safety, do not mock with a transient
|
||||||
|
* predecessor.
|
||||||
|
* In general, the predecessor may be in shared use
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
prev_brick = (void *)trans_input->connect->brick;
|
||||||
|
if (prev_brick &&
|
||||||
|
!prev_brick->power.led_on &&
|
||||||
|
!prev_brick->power.led_off)
|
||||||
|
continue;
|
||||||
|
|
||||||
(void)mars_disconnect((void*)trans_input);
|
(void)mars_disconnect((void*)trans_input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user