Help needed - PMIC settings and String variable corruption

@chipmc, waitFor() and waitUntil() call Particle.process() while waiting. You can do the same thing with the while() using while(!Particle.connected()) Particle.process(); :wink:

3 Likes

@peekay123,

Actually, thinking about this, I have a bit of a logical issue with: waitUntil(Particle.connected) or while(!Particle.connected()) Particle.process(); Is there anything to process while Particle is not connected?

Thanks,

Chip

@RWB,

Yep, It looks like EnableDPDM() fixed it.

Weird though, there is a DisableWatchdog() but there is no mention of watchdog in the link you send and there is no EnableWatchdog(). Any idea what the power.watchdog is?

Thanks,

Chip

Cool!

This thread may show you how to enable the watchdog again.

Specifically, this line which may be what you need to turn the watchdog back on again.

Particle.process() (internally spark_process()) does not only attend to the cloud tasks but also allows for WiFi stuff to be done and also allows for more ยตC cycles while connecting.

Just a few things to look at ...

void spark_process(void)
{
	// application thread will pump application messages
#if PLATFORM_THREADING
    if (system_thread_get_state(NULL) && APPLICATION_THREAD_CURRENT())
    {
        ApplicationThread.process();
        return;
    }
#endif

    // run the background processing loop, and specifically also pump cloud events
    Spark_Idle_Events(true);
}

...
void Spark_Idle_Events(bool force_events/*=false*/)
{
    HAL_Notify_WDT();

    ON_EVENT_DELTA();
    spark_loop_total_millis = 0;

    process_isr_task_queue();

    if (!SYSTEM_POWEROFF) {

#if Wiring_SetupButtonUX
        system_handle_button_clicks(false /* isIsr */);
#endif
        manage_serial_flasher();

        manage_network_connection();

        manage_smart_config();

        manage_ip_config();

        CLOUD_FN(manage_cloud_connection(force_events), (void)0);
    }
    else
    {
        system_pending_shutdown();
    }
    system_shutdown_if_needed();
}
2 Likes