DWM1000 and DW1000 compatibility

Code:

void loop() { 
  if (!sleepMode) {
    DW1000Ranging.loop();
  }
  if (Serial.available()) {
    int state = Serial.parseInt();
    if (state == 1) {
     sleepMode = false;
     DW1000.spiWakeup();
     Serial.println("ON");
     //ESP.restart();
     //DW1000.reset();
     //DW1000.softReset();
    }
    if (state == 2) {
      sleepMode = true;
      DW1000.deepSleep();
      Serial.println("OFF");
    }
  }  
}

I think something else is needed to sleep or wake up, there is something we are missing. Look at the code sequence:

1st test sleepMode false

  1. Start the DW1000Ranging.loop();
  2. I press 2 to turn it off and it goes to sleep.
  3. If I press 2 nothing happens, in that case it is recorded that it was disconnected from the device before. I press 2 again and nothing happens.

Screen Shot 2022-03-17 at 10.22.52 AM


2nd test sleepMode true:

  1. By default DW1000Ranging.loop(); does not start
  2. I press 1 and it does start.
  3. I press 2 to put him to sleep and he does sleep.
  4. I press 1 to wake it up again and nothing happens.

It tells me that the error is when I press 2. Because at first it did work.


3nd test without DW1000.deepSleep();:

If I remove DW1000.deepSleep(); it works. That is, it turns the loop on and off. My question is: is it actually sleeping or not? Does it still consume 160mAh?


void loop() { 
  if (!sleepMode) {
    DW1000Ranging.loop();
  }
  if (Serial.available()) {
    int state = Serial.parseInt();
    if (state == 1) {
     sleepMode = false;
     Serial.println("ON");
    }
    if (state == 2) {
      sleepMode = true;
      Serial.println("OFF");
    }
  }  
}