From 88156c794c3e26c7d40ba662ab60ce35b8b0f1e0 Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Sun, 23 Jun 2024 14:59:17 +0200 Subject: [PATCH] update comments --- GY521.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/GY521.cpp b/GY521.cpp index d86a247..c64ff60 100644 --- a/GY521.cpp +++ b/GY521.cpp @@ -78,16 +78,18 @@ void GY521::calibrate(uint16_t times) bool oldThrottle = _throttle; _throttle = false; - // set errors to zero, to get raw reads + // set all errors to zero, to get the raw reads. axe = aye = aze = 0; gxe = gye = gze = 0; - // use local error sums, to calculate the average error + // use local error sums, to calculate the average error. float _axe = 0, _aye = 0, _aze = 0; float _gxe = 0, _gye = 0, _gze = 0; // adjust times if zero. if (times == 0) times = 1; + + // summarize (6x) the measurements. for (uint16_t i = 0; i < times; i++) { read(); @@ -108,7 +110,7 @@ void GY521::calibrate(uint16_t times) gye = _gye * factor; gze = _gze * factor; - // restore throttle state + // restore throttle state. _throttle = oldThrottle; }