Introduction
Imagine using a device that runs out of battery very quickly because it keeps searching for WiFi or sending data all the time. Managing power use in WiFi devices is a big challenge, especially for small gadgets that rely on batteries.
Think of a person trying to hear a faint conversation in a noisy room. They have to pay close attention all the time, which tires them out quickly. If the room is quiet, they can relax and save energy. But if the conversation is far away or unclear, they must focus harder and get more tired.
┌───────────────────────────────┐ │ WiFi Device Power │ │ Consumption │ ├─────────────┬─────────────────┤ │ Continuous │ Frequent Data │ │ Radio │ Transmission │ │ Activity │ │ ├─────────────┼─────────────────┤ │ Idle │ Power Saving │ │ Listening │ Modes & │ │ │ Limitations │ ├─────────────┼─────────────────┤ │ Environmental Factors (Signal Strength & Obstacles) │ └─────────────────────────────────────────────────────┘
wifi.setPowerSave(true); correctly enables power-saving mode.if device.isIdle():
wifi.enterPowerSave()
else:
wifi.transmitData()
What is the expected effect on power consumption when the device is idle?device.isIdle() is true, the device calls wifi.enterPowerSave().if device.isIdle()
wifi.enterPowerSave()
else
wifi.transmitData()
What is the main error in this code?Pass the test and this pattern moves unknown