OPEnSLab-OSU / Loom

Arduino library for Internet of Things Rapid Prototyping in environmental sensing
GNU General Public License v3.0
26 stars 3 forks source link

BatchSD crashes with SSLClient #141

Closed BGoto808 closed 3 years ago

BGoto808 commented 3 years ago

Describe the bug Including BatchSD in the config file will cause the PublishPlat to display an SSLClient error when publishing to Google Sheets. The Dendrometer removed all BatchSD functions from the sketch but kept the BatchSD in the config with its parameters. An error with SSLClient popped up in the trials with BatchSD included, but published successfully without it.

Hardware in Use Feather M0 LoRa (x2) w/ antenna Ethernet FeatherWing

To Reproduce Steps to reproduce the behavior:

  1. Obtain 2 Feathers with LoRa. One will have the Ethernet Featherwing attached to publish to Google Sheets
  2. Upload code from Dendrometer's repository. The hub code to the Feather/Ethernet stack and the node to the single Feather.
  3. Edit the hub code to include BatchSD. No other functions need to be added to the sketch

Expected behavior The code would publish to Google Sheets successfully with or without BatchSD

Code

#include <Loom.h>

// Include configuration
const char* json_config = 
#include "config.h"
;

// Set enabled modules
LoomFactory<
	Enable::Internet::Ethernet,
	Enable::Sensors::Enabled,
	Enable::Radios::Enabled,
	Enable::Actuators::Disabled,
	Enable::Max::Disabled
> ModuleFactory{};

LoomManager Loom{ &ModuleFactory };

void setup() 
{ 

  pinMode(5, OUTPUT);    // Enable control of 3.3V rail
  pinMode(6, OUTPUT);   // Enable control of 5V rail
  digitalWrite(5, LOW); // Enable 3.3V rail
  digitalWrite(6, HIGH);  // Enable 5V rail
  
	Loom.begin_serial();
	Loom.parse_config(json_config);
	Loom.print_config();

	LPrintln("\n ** Setup Complete ** ");
	LPrintln("\n Looping... Please ignore recieve failure messages");
}

void loop() 
{	
	if (Loom.LoRa().receive_blocking(10000)) {
		Loom.display_data();
		//Lprintln(Loom.LoRa().get_rssi())
		if(!Loom.GoogleSheets().publish()) {
                Serial.println("failed to print to Gsheets");
            }
	}
}

Config

"{\
	'general':\
	{\
		'name':'Device',\
		'instance':1\
	},\
	'components':[\
    {\
      'name':'Digital',\
      'params':'default'\
    },\
		{\
			'name':'LoRa',\
			'params':[255,1,23,3,200]\
		},\
    {\
      'name':'GoogleSheets',\
      'params':[\
        'Goog',\
        7001,\
        '/macros/s/AKfycbzySpouxdaHYh6f1e7DI24i4s8XTGDe-X6d-9uaR7HVrpFNWUt7/exec',\
        '11bmZETLyFutZHwZRrpmsNFy0VrWmJ-myskjLZ6cZS-w',\
/*true to autoname tab*/        true,\
/*not used if previous param is true*/  'testTab'\
      ]\
    },\
    {\
			'name':'Ethernet',\
			'params':[\
				'Ether1',\
				[134,171,186,10,33,221],\
				[192,168,0,1]\
			]\
    }\
	]\
}"

BGoto808 commented 3 years ago

Update: It's not just with BatchSD but with the SD module in general. Dendrometer included just the regular SD module in the config and an SSLClient error pops up as well.

BGoto808 commented 3 years ago

Fixed: Turns out it wasn't a software issue, but a hardware conflict between the Ethernet Featherwing with the Hypnos. Both boards had the same chip select pin (pin 10) assigned so it was causing a conflict when trying to address either the Ethernet or SD. For now, a temporary solution is to solder the pad to a different pin as said on Adafruit's pinout page. We're planning on updating the Hypnos so that it's SD pin changes from pin 10 to pin 9 to mitigate this issue.