Skip to content

47: CPU2 Sleep โ€‹

๐Ÿงช Alpha

This message is specified, but not actively used by the Toit SDK at this time.

Request CPU2 sleep or WiFi override behaviour. For METHOD_SET, Header Duration (7) controls how long a forced WiFi override remains active. The same Duration timeout applies to both force-on and force-off modes.

FieldNameDescriptionType
5MethodRequest a service to be perform an action
Possible values:
  • 1: SETโ€” Set one or more values that are provided in the message payload.
  • 2: GETโ€” Get values for the associated message type.
  • 3: SUBSCRIBEโ€” Subscribe to values for the associated message type. Can be used in conjunction with other header fields to define the subscription parameters, such as Interval, Duration, Timeout, Storage Level and Message Level. If no interval is provided, messages will be sent as and when new data is available. Some data, such as GPS position, may require a set interval to be provided.
  • 5: UNSUBSCRIBEโ€” Unsubscribe from a previous subscription.
uint8
7DurationTo be used with the SUBSCRIBE method, or actions that can be timed.

When used with a timed action:
This defines how long the action should go on for.

When used with the SUBSCRIBE method:
This defines a duration to keep the subscription active for.
A value of 0 means the subscription is indefinite until explicitly unsubscribed.
An ACK with EXPIRED status code will be sent if the subscription duration elapses without being renewed with a new subscription request.
uint32
This is an extract of header fields that are relevant to this message type, you can find them all documented in the Headers section.

Payload โ€‹

FieldNameDescriptionTypeUnit
2Wake on EventShould CPU1 wake up CPU2 on new events / messagesbool
10WiFi Override ModeForced WiFi override mode.
Possible values:
  • 0: Force Offโ€” Force WiFi off for the Duration timeout (or indefinitely if Duration is omitted).
  • 1: Force Onโ€” Force WiFi on for the Duration timeout (or indefinitely if Duration is omitted).
  • 2: Clear Overrideโ€” Clear any forced WiFi override and return to normal WiFi power behavior.
uint8

Examples โ€‹

Force WiFi on to disable ESP hibernation
Send METHOD_SET with wifiOnOff=1 and wakeOnEvent=0. Set Header Duration (7) to define the forced-on time in ms. This forces WiFi on and prevents the ESP hibernate path while the override is active. If Duration is omitted, the forced-on state remains until changed by a later request.
Clear WiFi override (return to normal behavior)
Send METHOD_SET with wifiOnOff=2. This clears any forced WiFi override immediately, without forcing ON or OFF.

Code โ€‹

For convenience, the following constants can be used to reference this message type.