Skip to content

feat(lte): command to reboot modem#487

Merged
fouge merged 1 commit into
mainfrom
fouge/reboot-lte-modem
Mar 26, 2026
Merged

feat(lte): command to reboot modem#487
fouge merged 1 commit into
mainfrom
fouge/reboot-lte-modem

Conversation

@fouge

@fouge fouge commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

on diamond prod devices
still gated on pearl (debug only)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for rebooting (power-cycling) the LTE modem power rail via the existing power_cycle_supply() mechanism, enabling it on Diamond production builds while keeping Pearl gated.

Changes:

  • Allow orb_mcu_main_PowerCycle_Line_LTE_3V3 power-cycling on CONFIG_BOARD_DIAMOND_MAIN outside of CONFIG_DEBUG.
  • Explicitly return RET_ERROR_FORBIDDEN for LTE_3V3 on Pearl when not in debug.
  • Adjust the board-conditional GPIO configuration path used when power-cycling LTE.
Comments suppressed due to low confidence (1)

main_board/src/power/boot/boot.c:515

  • case orb_mcu_main_PowerCycle_Line_LTE_3V3 is now defined inside #ifdef CONFIG_DEBUG, but ret is only assigned under #if defined(CONFIG_BOARD_PEARL_MAIN). On Diamond (or any non-Pearl debug build), this leaves ret uninitialized before ASSERT_SOFT(ret), and also makes this case overlap with the later Diamond/Pearl LTE_3V3 cases (duplicate case labels when CONFIG_DEBUG is enabled). Restructure the preprocessor conditions so only one LTE_3V3 case is compiled per build and ensure ret is always initialized in the compiled path.
    case orb_mcu_main_PowerCycle_Line_LTE_3V3:
#if defined(CONFIG_BOARD_PEARL_MAIN)
        ret = gpio_pin_configure_dt(&lte_gps_usb_reset_gpio_spec,
                                    GPIO_OUTPUT_INACTIVE);
#endif
        ASSERT_SOFT(ret);
        k_work_schedule(&power_cycle_lte_3v3_line_work,
                        duration_off_ms != 0 ? K_MSEC(duration_off_ms)
                                             : K_MSEC(3000));
        break;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +527 to +534
case orb_mcu_main_PowerCycle_Line_LTE_3V3:
ret = gpio_pin_configure_dt(&supply_3v3_lte_enable_gpio_spec,
GPIO_OUTPUT_INACTIVE);
ASSERT_SOFT(ret);
k_work_schedule(&power_cycle_lte_3v3_line_work,
duration_off_ms != 0 ? K_MSEC(duration_off_ms)
: K_MSEC(3000));
break;

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Diamond LTE_3V3 power-cycle path schedules power_cycle_lte_3v3_line_work, but that work item (and its handler) are currently defined under #ifdef CONFIG_DEBUG above. In non-debug (prod) builds, this will fail to link/compile. Consider moving the LTE work handler/K_WORK_DELAYABLE_DEFINE behind a condition like CONFIG_DEBUG || CONFIG_BOARD_DIAMOND_MAIN, or defining a separate always-on handler for Diamond.

Copilot uses AI. Check for mistakes.
Comment on lines 547 to 552
break;
case orb_mcu_main_PowerCycle_Line_LTE_3V3:
/* forbidden on Pearl if not DEBUG */
ret = RET_ERROR_FORBIDDEN;
break;
#endif

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Pearl-side case orb_mcu_main_PowerCycle_Line_LTE_3V3 added here is compiled whenever CONFIG_BOARD_DIAMOND_MAIN is not set, even in debug builds. Since there is already an LTE_3V3 case inside the earlier #ifdef CONFIG_DEBUG block, enabling CONFIG_DEBUG on Pearl will produce a duplicate case label compile error. Gate this forbidden case with #if !defined(CONFIG_DEBUG) (or otherwise refactor the switch) so only one LTE_3V3 case exists per configuration.

Suggested change
break;
case orb_mcu_main_PowerCycle_Line_LTE_3V3:
/* forbidden on Pearl if not DEBUG */
ret = RET_ERROR_FORBIDDEN;
break;
#endif
break;
#if !defined(CONFIG_DEBUG)
case orb_mcu_main_PowerCycle_Line_LTE_3V3:
/* forbidden on Pearl if not DEBUG */
ret = RET_ERROR_FORBIDDEN;
break;
#endif
#endif

Copilot uses AI. Check for mistakes.
on diamond prod devices
still gated on pearl (debug only)

Signed-off-by: Cyril Fougeray <cyril.fougeray@toolsforhumanity.com>
@fouge fouge force-pushed the fouge/reboot-lte-modem branch from fd9be35 to 79ad6be Compare March 26, 2026 08:26
@fouge fouge merged commit d985945 into main Mar 26, 2026
15 checks passed
@fouge fouge deleted the fouge/reboot-lte-modem branch March 26, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants