We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84c98f3 commit 08d2495Copy full SHA for 08d2495
src/Modulino.h
@@ -412,26 +412,29 @@ class ModulinoDistance : public Module {
412
operator bool() {
413
return (tof_sensor != nullptr);
414
}
415
- floatget() {
+ boolavailable() {
416
if (tof_sensor == nullptr) {
417
- return NAN;
+ return false;
418
419
+ float ret = internal;
420
uint8_t NewDataReady = 0;
421
tof_sensor->VL53L4CD_CheckForDataReady(&NewDataReady);
422
if (NewDataReady) {
423
tof_sensor->VL53L4CD_ClearInterrupt();
424
tof_sensor->VL53L4CD_GetResult(&results);
425
426
if (results.range_status == 0) {
- return results.distance_mm;
427
+ internal = results.distance_mm;
428
} else {
429
+ internal = NAN;
430
431
+ return !isnan(internal);
432
- boolisValid(float distance) {
- return !isnan(distance);
433
+ float get() {
434
+ return internal;
435
436
private:
437
VL53L4CD* tof_sensor = nullptr;
438
VL53L4CD_Result_t results;
439
+ float internal = NAN;
440
};
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments