@@ -236,14 +236,26 @@ float RAK12035_SoilMoisture::get_sensor_temperature() //Command 05
236236
237237bool RAK12035_SoilMoisture::sensor_sleep () // Command 06 - (w) 1 byte
238238{
239+ // This routine is for a future firmware version that supports a sleep command.
240+ // It is not currently utilized in the sensor firmware, but is included here for
241+ // completeness and for future use with sensor power management functionality.
242+
239243 uint8_t tmp = 0 ;
240244 if (!write_rak12035 (SOILMOISTURESENSOR_SET_SLEEP, &tmp, 1 )) {
241245 MESH_DEBUG_PRINTLN (" Function 6: sensor_sleep() FAIL: Could not send sleep command" );
242246 return false ;
243247 }
244248 MESH_DEBUG_PRINTLN (" Function 6: sensor_sleep() SUCCESS: Sensor acknowledged sleep command" );
245249 // Optional: turn off sensor power AFTER successful sleep command
246- digitalWrite (WB_IO2, LOW);
250+
251+ // digitalWrite(WB_IO2,// LOW); //Uncomment this line to turn off the 3v3_S power
252+
253+ // This is done after sending the sleep command. This is optional, but can save power if the
254+ // sensor is not needed for a long time. Note that the sensor will not wake up until
255+ // power is cycled and the sensor is reset.
256+ // So this is best used in scenarios where the device will be restarted
257+ // or power cycled periodically.
258+
247259 return true ;
248260}
249261
@@ -401,15 +413,20 @@ bool RAK12035_SoilMoisture::getEvent(uint8_t *humidity, uint16_t *temp)
401413
402414bool RAK12035_SoilMoisture::sensor_on ()
403415{
416+ // This routine is for a future firmware version that supports sensot power management.
417+ // It is not currently utilized in the sensor firmware, but is included here for
418+ // completeness and future use to initialize the sensor after being turned off.
419+
404420 uint8_t data;
421+ /*
405422 pinMode(WB_IO2, OUTPUT);
406423 digitalWrite(WB_IO2, HIGH); //Turn on Sensor Power
407424
408425 pinMode(WB_IO4, OUTPUT); //Set IO4 Pin to Output (connected to *reset on sensor)
409426 digitalWrite(WB_IO4, LOW); //*reset - Reset the Sensor
410427 delay(1); //Wait for the minimum *reset, 1mS is longer than required minimum
411428 digitalWrite(WB_IO4, HIGH); //Deassert Reset
412-
429+ */
413430 delay (10 ); // Wait for the sensor code to complete initialization
414431
415432 uint8_t v = 0 ;
@@ -428,6 +445,10 @@ bool RAK12035_SoilMoisture::sensor_on()
428445
429446bool RAK12035_SoilMoisture::reset ()
430447{
448+ // This routine is for a future firmware version that supports sensor power management.
449+ // It is not currently utilized in the sensor firmware, but is included here for
450+ // completeness and future use to reset the sensor after being turned back on.
451+
431452// Atmel 8495 Microcoltroller: Reset input. A low level on this pin for longer than
432453// the minimum pulse length will generate a reset, even if the clock is not
433454// running and provided the reset pin has not been disabled. The minimum pulse length is
0 commit comments