-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISSUE: Works on NRF52840 but apparently not Arduino boards #1
Comments
Possible SolutionInstalling the ArxTypeTraits Arduino library manages to fix some of these issues. This would both FIX the problem, AND also allow the internal debugger to function if requested! DovesLapTimer.hdiff --git a/src/DovesLapTimer.h b/src/DovesLapTimer.h
index e3359b9..fc131c2 100644
--- a/src/DovesLapTimer.h
+++ b/src/DovesLapTimer.h
@@ -10,10 +10,9 @@
#ifndef _DOVES_LAP_TIMER_H
#define _DOVES_LAP_TIMER_H
-#include <cfloat>
#include <math.h>
#include "Arduino.h"
-#include <algorithm>
+#include "ArxTypeTraits.h"
using TRITYPE = double;
@@ -372,7 +371,7 @@ private:
#ifndef DOVES_UNIT_TEST
// Number of GPS coordinates to store in the buffer for interpolation
- static const int crossingPointBufferSize = 500;
+ static const int crossingPointBufferSize = 50;
crossingPointBufferEntry crossingPointBuffer[crossingPointBufferSize];
int crossingPointBufferIndex = 0; Concerns
Possible solution for cfloatWe are really only calling the library to set a default high value during a comparison. // Variables to store the best pair of points
int bestIndexA = -1;
int bestIndexB = -1;
- double bestSumDistances = DBL_MAX;
+ double bestSumDistances = 10000.0; Final concerns before merging changes
|
With a little more tinkering, i might have a more viable solution., Still more research to be done. Note: Reset master and apply this patch only! This should in theory keep the functionality the same for the NRF52840, and drop the required crossing point buffer for the chips with less ram. Change #4 NEEDS to be done for me to feel secure about merging this change. This patch is expirimental DovesLapTimer.hdiff --git a/src/DovesLapTimer.h b/src/DovesLapTimer.h
index e3359b9..d67d239 100644
--- a/src/DovesLapTimer.h
+++ b/src/DovesLapTimer.h
@@ -10,10 +10,14 @@
#ifndef _DOVES_LAP_TIMER_H
#define _DOVES_LAP_TIMER_H
-#include <cfloat>
-#include <math.h>
-#include "Arduino.h"
-#include <algorithm>
+
+#if __has_include("cfloat")
+ #include <cfloat>
+#else
+ #define DBL_MAX 100000.0;
+#endif
+
+#include "ArxTypeTraits.h"
using TRITYPE = double;
@@ -264,7 +268,12 @@ public:
double catmullRom(double p0, double p1, double p2, double p3, double t);
void interpolateCrossingPoint(double& crossingLat, double& crossingLng, unsigned long& crossingTime, double& crossingOdometer, double pointALat, double pointALng, double pointBLat, double pointBLng);
- static const int crossingPointBufferSize = 300;
+ #if ((RAMEND - RAMSTART) > 3000 )
+ static const int crossingPointBufferSize = 200;
+ #else
+ static const int crossingPointBufferSize = 50;
+ #endif
+
crossingPointBufferEntry crossingPointBuffer[crossingPointBufferSize];
int crossingPointBufferIndex = 0;
bool crossingPointBufferFull = false;
@@ -371,8 +380,12 @@ private:
const double radiusEarth = 6371.0 * 1000;
#ifndef DOVES_UNIT_TEST
- // Number of GPS coordinates to store in the buffer for interpolation
- static const int crossingPointBufferSize = 500;
+ // UNTESTED: Hotfix for low memory systems
+ #if ((RAMEND - RAMSTART) > 3000 )
+ static const int crossingPointBufferSize = 200;
+ #else
+ static const int crossingPointBufferSize = 50;
+ #endif
crossingPointBufferEntry crossingPointBuffer[crossingPointBufferSize];
int crossingPointBufferIndex = 0; |
Pushed possible solutions, be on your toes when running on underpowered hardware though. Can possibly open again if people are still suffering from problems, I believe the latest code should work on an arduino MEGA now, but not sure if it has the power to process the library and log to an SD card. |
Problem
Werks On My Machine(tm)
Description
So there seems to be a slight problem with the library when running on an actual arduino.
I had originally built this for the Seeed NRF52840 | Amazon Link (NOT A REFERRAL)
This seems to cause a problem with my "fancy" internal debugging system, the use of
std:swap
, and possibly some issues with my use of floats. I have produced a small patch that manages to stop the errors, but now produces a "Not enough memory" error on various other arduino boards.I hope this helps some users who were having issues, this is the first time I have developed a publicly exposed library for a microcontroller so bare with me while I attempt to solve the issue.
If you are suffering from a similar issue, please comment below with your arduino IDE version, and the microcontroller you are attempting to compile for.
Temp Solution
If you have half of a brain you could apply this simple patch and try to help me out.
UPDATE: reducing the logging points to 50 allows it to compile for an "Arduino Leonardo", do with this information as you will, I will investigate further.
nrfToArduino.patch
DovesLapTimer.h
DovesLapTimer.cpp
The text was updated successfully, but these errors were encountered: