Skip to content
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

Example sketch won't compile, "default argument given for parameter 2" #2

Open
mantonakakis1 opened this issue Feb 15, 2019 · 4 comments

Comments

@mantonakakis1
Copy link

Example 1 sketch won't compile, I get the following error message(s):

Arduino: 1.8.8 (Windows 10), Board: "SparkFun SAMD21 Pro RF"

C:\Users\Mike\Documents\Arduino\libraries\SparkFun_Qwiic_OpenLog\src\SparkFun_Qwiic_OpenLog_Arduino_Library.cpp:274:73: error: default argument given for parameter 2 of 'boolean OpenLog::sendCommand(uint8_t, String) [-fpermissive]

boolean OpenLog::sendCommand(uint8_t registerNumber, String option1 = "")

In file included from C:\Users\Mike\Documents\Arduino\libraries\SparkFun_Qwiic_OpenLog\src\SparkFun_Qwiic_OpenLog_Arduino_Library.cpp:28:0:

C:\Users\Mike\Documents\Arduino\libraries\SparkFun_Qwiic_OpenLog\src\SparkFun_Qwiic_OpenLog_Arduino_Library.h:148:13: error: after previous specification in 'boolean OpenLog::sendCommand(uint8_t, String)' [-fpermissive]

boolean sendCommand(uint8_t registerNumber, String option1 = "");

exit status 1
Error compiling for board SparkFun SAMD21 Pro RF.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

If I remove the default argument from the sendCommand definition in the .cpp file, it compiles, i.e. when:
boolean OpenLog::sendCommand(uint8_t registerNumber, String option1)
replaces:
boolean OpenLog::sendCommand(uint8_t registerNumber, String option1 = "")

Using a SparkFun SAMD21 Pro RF and the SparkX qwiic OpenLog, I have another issue once the code is uploaded - the output of my .txt file on the SD card, running Example 1, looks like:
txt_file_output

This matches an issue I had with another version of the library (as of Jan 26th, 2019) when used with the same hardware - randomly missing characters in the output file, skipped new lines, although no random up arrows (raised as an issue in the github for that version of the library, here). Running the same sketch multiple times resulted in completely random point of error, i.e. sometimes a new line would come out correctly, other times it wouldn't, and would cut off in random spots. Now, with this version, I get the random up-arrows, as well as the randomly cut off lines.

Last I checked, the circa 1/26/2019 version of the library worked fine when the SparkX qwiic OpenLog was hooked up to a BlackBoard instead of the SAMD21 Pro RF.

@AndyEngland521
Copy link
Contributor

The SparkX version of the OpenLog runs a different firmware version than the new SparkFun OpenLog. You will need to update the firmware on your SparkX OpenLog to the most current version (contained in this repo) in order to get things working. In the mean time I'm looking into your compile error on SAMD21.

@mattljc
Copy link

mattljc commented Feb 24, 2019

I'm having similar issues with the Red version of the qwiic OpenLog connected to a SAMD21 RedBoard Turbo. Running example 1 results in missing characters and missing newlines.

Things tried so far:

  • Adding 100ms delays after print statements to ensure the buffers clear
  • Increasing and decreasing the I2C clock speed
  • Reducing string lengths to 8 chars

@mantonakakis1
Copy link
Author

The SparkX version of the OpenLog runs a different firmware version than the new SparkFun OpenLog. You will need to update the firmware on your SparkX OpenLog to the most current version (contained in this repo) in order to get things working. In the mean time I'm looking into your compile error on SAMD21.

Updated the SparkX Qwiic OpenLog to firmware 2.0 by uploading the Qwiic_OpenLog.ino file from the latest firmware folder using an FTDI board (confirmed the firmware update worked by changing the "no card" error from 3 blinks to 2 blinks), making sure I followed the instructions in the HookUp guide regarding supprting libraries.

I then tried writing some simple data to the SD card with a BlackBoard. It writes consistently, but it is SLOW. With 20ms delay between three print commands (time, a comma, and a counter value), I get about 1.5 to 1.8 seconds per loop. It was also extremely slow running some of the examples in the library.

Tomorrow I will test with the non-X version of the OpenLog, without any firmware changes from the way it shipped, using the BlackBoard.

Here's the code I tested with:

#include <Wire.h>
#include "SparkFun_Qwiic_OpenLog_Arduino_Library.h"
OpenLog myLog;
  
int now = 0;
int loopDelay = 20;
int count = 0;

void setup()
{  
  Serial.begin(9600);
  Serial.println("Starting"); 
  Wire.begin();
  Wire.setClock(400000);
  pinMode(LED_BUILTIN, OUTPUT);
  delay(100);
  myLog.begin();
  delay(100);
}

void loop()
{
  now = millis();
  myLog.print(now);
  delay(loopDelay);
  myLog.print(", ");
  delay(loopDelay);  
  myLog.println(count);    
  count++;
  digitalWrite(LED_BUILTIN, HIGH);
  delay(20);
  digitalWrite(LED_BUILTIN, LOW);
}

@mantonakakis1
Copy link
Author

mantonakakis1 commented Mar 11, 2019

After my last post I reflashed the firmware without any changes, and it suddenly worked a bit better - but for the 60ms of total delay in my loop function, I was getting about 150-250ms per loop. After a few seconds, one of the times through the loop would slow down a lot, closer to 1s, then back to ~200ms.

Tried the same sketch with the new "red" version of the Qwiic OpenLog with whatever firmware it shipped with, and got the same result.

Tried another SparkX version of the board, with whatever firmware it shipped with about 2 months ago, and it wrote much faster, subjectively looked like it was running at the full 60ms loop speed. Unfortunately, the new library doesn't match the firmware it and prints the garbled output with the "spades" symbols (so I can't say for sure how fast it was).

So I think I can conclude the following with a bit of confidence:

  • New firmware is quite slow, regardless of board version, using the latest firmware and libraries on a BlackBoard.
  • New version of the board with stock firmware writes faster with a SAMD21 board, but incomplete print commands, missed new lines, etc.
  • Old firmware seems like it doesn't suffer the same speed issues, but it doesn't work well with new libraries, which makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants