From c5351c536d539580362ebb6c9363495a40538f32 Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Tue, 6 Jun 2017 09:12:28 -0400 Subject: [PATCH 1/9] Started reducing battery usage --- bodgecycle/bodgecycle.ino | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bodgecycle/bodgecycle.ino b/bodgecycle/bodgecycle.ino index 9d0b6e3..94014eb 100644 --- a/bodgecycle/bodgecycle.ino +++ b/bodgecycle/bodgecycle.ino @@ -86,7 +86,7 @@ char logFileName[10]; // Char string to store the log file name ////////////////////// // Log Rate Control // ////////////////////// -#define LOG_RATE 1000 // Log every second +unsigned int log_rate = 1000 // Log every second unsigned long lastLog = 0; // Global var to keep of last time we logged ///////////////////////// @@ -129,11 +129,15 @@ void setup() // Wait to start printing headers and such until there are enough satellites while (!tinyGPS.location.isUpdated()) { - // Query the GPS unit - getGPSData(); + // This code should make the gps tracker thrash less. + if ((lastLog + log_rate) <= millis()) + { + // Query the GPS unit + getGPSData(); - SerialMonitor.print(F("Checking for satellites. Current count: ")); - SerialMonitor.println(tinyGPS.satellites.value()); + SerialMonitor.print(F("Checking for satellites. Current count: ")); + SerialMonitor.println(tinyGPS.satellites.value()); + } } updateFileName(); // Each time we start, create new file, increment the number printHeader(); // Print a header at the top of the new file @@ -142,8 +146,8 @@ void setup() void loop() { // It sure would be nice to have the log rate speed up once GPS is found. - if ((lastLog + LOG_RATE) <= millis()) - { // If it's been LOG_RATE milliseconds since the last log: + if ((lastLog + log_rate) <= millis()) + { // If it's been log_rate milliseconds since the last log: if (tinyGPS.location.isUpdated()) // If the GPS data is vaild { if (logGPSData()) // Log the GPS data From d60cc85b040682a5d3e627349d3943edcfb272cc Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Tue, 6 Jun 2017 13:05:53 -0400 Subject: [PATCH 2/9] Introduced log rate scaling --- bodgecycle/bodgecycle.ino | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/bodgecycle/bodgecycle.ino b/bodgecycle/bodgecycle.ino index 94014eb..2ccb5b9 100644 --- a/bodgecycle/bodgecycle.ino +++ b/bodgecycle/bodgecycle.ino @@ -64,6 +64,7 @@ * TODO: * Introduce battery monitoring * Reduce power usage + * Find a way to see if bearing has changed */ #include @@ -86,7 +87,7 @@ char logFileName[10]; // Char string to store the log file name ////////////////////// // Log Rate Control // ////////////////////// -unsigned int log_rate = 1000 // Log every second +unsigned int log_rate = 16384; // Start by logging every quarter of a minute unsigned long lastLog = 0; // Global var to keep of last time we logged ///////////////////////// @@ -114,6 +115,11 @@ SoftwareSerial ssGPS(ARDUINO_GPS_TX, ARDUINO_GPS_RX); // Create a SoftwareSerial // 'Serial' on other boards this may be 'SerialUSB' #define SerialMonitor Serial +/////////////////////// +// BEARING VARIABLES // +/////////////////////// +long int last_speed = 0; + void setup() { SerialMonitor.begin(9600); @@ -139,6 +145,8 @@ void setup() SerialMonitor.println(tinyGPS.satellites.value()); } } + last_speed = tinyGPS.speed.kmph(); // Set last speed for later calculations + log_rate = 1024; // Start logging about once a second updateFileName(); // Each time we start, create new file, increment the number printHeader(); // Print a header at the top of the new file } @@ -154,6 +162,17 @@ void loop() { SerialMonitor.println(F("GPS logged.")); // Print a debug message lastLog = millis(); // Update the lastLog variable + + // Adjust the log rate based on the change in speed + if ( // If the speed has changed by 5 kmph, reset the log rate + last_speed - tinyGPS.speed.kmph() < 5 || + tinyGPS.speed.kmph() - last_speed < 5) + { + log_rate = 1024; + } else if (!(log_rate >= 8192)) { + // At most wait about 8 seconds + log_rate = log_rate * 2; + } } else // If we failed to log GPS { // Print an error, don't update lastLog From cab68c04e4ebff9f26866fcc66ed3be82b2396d8 Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Tue, 20 Jun 2017 18:41:24 -0400 Subject: [PATCH 3/9] Fixed a filesystem bug --- bodgecycle/bodgecycle.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bodgecycle/bodgecycle.ino b/bodgecycle/bodgecycle.ino index 2ccb5b9..c88adc2 100644 --- a/bodgecycle/bodgecycle.ino +++ b/bodgecycle/bodgecycle.ino @@ -269,7 +269,10 @@ void printHeader() // Now we do the actual factual GPS tracking. logFile = SD.open(logFileName, FILE_WRITE); - + while(!logFile){ + logFile = SD.open(logFileName, FILE_WRITE); + } + if(logFile) { logFile.println(); From 5fe61830606fac2418c5964068a0ec7cb1abe3c9 Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Wed, 21 Jun 2017 20:19:20 -0400 Subject: [PATCH 4/9] Attempted to fix a file write bug --- bodgecycle/bodgecycle.ino | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/bodgecycle/bodgecycle.ino b/bodgecycle/bodgecycle.ino index c88adc2..298fd06 100644 --- a/bodgecycle/bodgecycle.ino +++ b/bodgecycle/bodgecycle.ino @@ -272,20 +272,17 @@ void printHeader() while(!logFile){ logFile = SD.open(logFileName, FILE_WRITE); } - - if(logFile) - { - logFile.println(); - logFile.println(F("\t")); - logFile.println(F("\tRide")); - // If I do this right, all of the tags will be closed. + logFile.println(); + logFile.println(F("\t")); + logFile.println(F("\tRide")); - // Close the file. - // logFile.close(); + // If I do this right, all of the tags will be closed. - printFooter(); - } + // Close the file. + logFile.close(); + + printFooter(); } } From fa8a5c9a7cab6fee56118d3e38e2416076833390 Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Wed, 21 Jun 2017 20:57:12 -0400 Subject: [PATCH 5/9] I think this is more efficient --- bodgecycle/bodgecycle.ino | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/bodgecycle/bodgecycle.ino b/bodgecycle/bodgecycle.ino index 298fd06..73952e8 100644 --- a/bodgecycle/bodgecycle.ino +++ b/bodgecycle/bodgecycle.ino @@ -269,20 +269,17 @@ void printHeader() // Now we do the actual factual GPS tracking. logFile = SD.open(logFileName, FILE_WRITE); - while(!logFile){ - logFile = SD.open(logFileName, FILE_WRITE); + if(logFile) { + logFile.println(); + logFile.println(F("\t")); + logFile.println(F("\tRide")); + + // If I do this right, all of the tags will be closed. + + // Close the file. + logFile.close(); + printFooter(); } - - logFile.println(); - logFile.println(F("\t")); - logFile.println(F("\tRide")); - - // If I do this right, all of the tags will be closed. - - // Close the file. - logFile.close(); - - printFooter(); } } From f19071cff751f7d7dbe337b85666def79caa1d04 Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Wed, 21 Jun 2017 22:36:41 -0400 Subject: [PATCH 6/9] Data was still being logged super frequently --- bodgecycle/bodgecycle.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bodgecycle/bodgecycle.ino b/bodgecycle/bodgecycle.ino index 73952e8..c49f098 100644 --- a/bodgecycle/bodgecycle.ino +++ b/bodgecycle/bodgecycle.ino @@ -87,6 +87,7 @@ char logFileName[10]; // Char string to store the log file name ////////////////////// // Log Rate Control // ////////////////////// +#define DATA_AGGRESSIVENESS 10 // Controls how often data logging is scaled unsigned int log_rate = 16384; // Start by logging every quarter of a minute unsigned long lastLog = 0; // Global var to keep of last time we logged @@ -165,8 +166,8 @@ void loop() // Adjust the log rate based on the change in speed if ( // If the speed has changed by 5 kmph, reset the log rate - last_speed - tinyGPS.speed.kmph() < 5 || - tinyGPS.speed.kmph() - last_speed < 5) + last_speed - tinyGPS.speed.kmph() < DATA_AGGRESSIVENESS || + tinyGPS.speed.kmph() - last_speed < DATA_AGGRESSIVENESS) { log_rate = 1024; } else if (!(log_rate >= 8192)) { From e1994d5de4b6006450f738eba9861f61e01e0cac Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Wed, 21 Jun 2017 23:31:25 -0400 Subject: [PATCH 7/9] Added community guidelines --- ISSUE_TEMPLATE.md | 5 +++++ PULL_REQUEST_TEMPLATE.md | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 ISSUE_TEMPLATE.md create mode 100644 PULL_REQUEST_TEMPLATE.md diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..5ccf505 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,5 @@ +# Here's what's going on +Enter some text here about the current state of things + +# Here's what should be going on +Enter some text here about where things should be going diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ad49641 --- /dev/null +++ b/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,10 @@ +# Here's how my project files differ from the ones that this project has +Enter some text here describing what it is that you changed + +# Here's why I changed the things that I changed +Enter some text here describing why it is that you changed what you changed + +# Here's why the things that I changed are important +Enter some text here explaining why the project should make your changes a part +of the main project repository. This would be a great place to reference an +issue in the issue tracker From 2e639b87667c5c7ad7aadd8cc7bb2e493e97fd2e Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Thu, 22 Jun 2017 00:12:03 -0400 Subject: [PATCH 8/9] Create CONTRIBUTING.md --- CONTRIBUTING.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..560442b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,57 @@ +# Contributing +So you want to become a contributor to the Bodgecycle Computer project? Oh my gosh! Come in! Sit down! Have a coffee drink of +some sort! You might not be able to tell from the names of the names of the project releases, but we love coffee around here. +As much as possible, Bodgecycle Computer users should feel welcome to be Bodgecycle Computer contributors. There are +some things that users that want to become contributors should know before they jump into the deep end. + +## Code of Conduct +You absolutely must follow this project's Code of Conduct. Anyone who doesn't follow the code of conduct will not be invited to +come ride bikes. They will not be offered coffee. + +## Code of Conduct +The Code of Conduct is important enough that it bears repeating. You need to follow the Code of Conduct. It was set up to help +contributors be nice to eachother. In fact, it would be best if you weren't just nice to fellow contributors but also your fellow +humans in accordance with whatever ethical system you follow. Worth noting, Travis Rigg is not a relatavist and offers a human +Code of Conduct in the form of a paper of Global Ethics which is available in PDF format upon request. + +## Code of Conduct +I hope you understand by now how important the Code of Conduct is around here. + +## Filing Bug Reports +All of the issue tracking for the Bodgecycle Computer project is done through GitHub. + +## Suggesting New Features +Create an issue on github. Make sure the name of your issue has the following format: + [SUGGESTION] It would be the most rad if the project did this + +## Setting Up Your Environment +See the installation guide in the readme. + +# What Would be Good to Contribute? +Anything really. But what is most needed is bug reports. As of right now there is exactly one known bodgecycle computer. It is +currently sitting on top of dresser and not being taken out for a ride. In fact, it spends a lot of time not being taken out for +rides. In fact, it goes out on at most one ride a day, and usually not even that. It can take a long time for the process of bug +creation, bug identification, bug diagnosis, bug treatment, bug treatment testing, bug curing to happen. + +It would also be super rad if you looked in the issue tracker and picked an issue you like. Please focus on software issues and +not hardware issues. The software issues are the ones that the main (only?) developer, Travis Rigg can immediately test. Hardware +issues will almost definitely get addressed after the software ones are entirely addressed. + +# What is the Vision for the Project? +It is important that potential contributors know what it is that the project is trying to be. Bodgecycle Computers are meant for +people who own Arduino boards and want to build a bicycle computer on the cheap. It is nearly impossible for a Bodgecycle +Computer to compete with a storebought bicycle computer. For about \$100 you can get a bicycle computer that will do everything +you could possibly need it to do. I'm sure some crazy souls out there will likely be able to cut costs in places in order to make +an even cheaper Bodgecycle Computer, and that's good for them, but they're not the target audience. They're likely savvy enough +that if they had wanted to do such a thing, they already would have, or have done so. + +# Getting in Touch +The main (only right now) developer of Bodgecycle Computer is Travis Rigg. You can reach him at rigg.travis@gmail.com. He is also +on Twitter but probably won't get back to you. Do not try to contact him on Facebook as he will get very upset and demand that +you leave him alone. If you manage to get his phone number somewhere and call him, he will get the most upset and probably call +the police. An email is definitely the best way to get in touch with Travis Rigg. + +Also, please do get in touch! Travis Rigg loves talking about his soldering projects to anyone who will listen. He has a let's +split keyboard that he finished building recently that he is very proud of the solders on. He also gets really excited when +someone thinks one of his projects is neat. We're talking he goes absolutely bonkers nuts and lets everyone he knows that someone +talked to him about one of his projects. From e92841cfa25627c8e8e90f5e29e903d16d987e91 Mon Sep 17 00:00:00 2001 From: Travis Rigg Date: Thu, 22 Jun 2017 00:16:44 -0400 Subject: [PATCH 9/9] Update readme.md added links to relevant information for contributing. --- readme.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/readme.md b/readme.md index 0373ca4..a05cb74 100644 --- a/readme.md +++ b/readme.md @@ -200,6 +200,13 @@ file you have recorded in some sort of ![Into the computer](http://i.imgur.com/eROZaRi.jpg) ![Again, listen for a click](http://i.imgur.com/Gzp8oLM.jpg) +## Contributing +You want to contribute? That's great! We would love to welcome you aboard. There are just a few things +you should know first. They are laid out in our +[Code of Conduct](https://github.com/riggtravis/BodgecycleComputer/blob/master/CODE_OF_CONDUCT.md) and +[Contributing Guide](https://github.com/riggtravis/BodgecycleComputer/blob/master/CONTRIBUTING.md). +Please go and read them before you do anything else. + ## Limitations However you take your Bodgecycle computer with you, be it in a sandwich bag, in a butter tub, in an enclosure on your bike, or just loose in a jersey pocket,