Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Add Transcriber and Portal objects. #215

Merged
merged 11 commits into from
Nov 4, 2016

Conversation

ed7coyne
Copy link
Collaborator

This will be the core of the new firethings project. It is responsible for connecting pins to the cloud and the cloud to pins.

#define ANALOG_IN A0
#define ANALOG_OUT D8

thing::Config config = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should keep the namespace in the Arduino surface, iirc, it's not very common.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I think this has to do with splitting the library, This example isn't really meant to be arduino developer friendly (like the config struct isn't too friendly), the example is just to give people a chance to play with the Transcriber outside of the rest of the system.

}

void Transcriber::SetValue(const std::string& path, const std::string& value) {
stream_.reset(nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that close the connection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I added http->end() to the FirebaseCall destructor, I don't think it is necessary as the Esp8266HttpClient destructor is doing this too but since we have a portability layer everything in the future may not.

// Send values to cloud
int digital_in = digitalRead(pin_digital_in_);
if (digital_in != digital_in_) {
SetValue(path_ + kSubPathDigitalIn, String(digital_in).c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could batch those?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely could. It would be a little work to build the json stub to send, sending the raw values is far easier.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be easily 2x faster, as the tax for each http request is quite big.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create issue for those?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new issue #222

}

float analog_in = analogRead(pin_analog_in_);
if (analog_in != analog_in_) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably have a threshold

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been considering that as well but I am unsure if we can define a common threshold. I haven't done enough analog reading. I usually define one empirically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the threadshold could be part of the config?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not against it, lets consider this a future feature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I'm worried here is that no threshold might trigger a send on each loop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create issue for those?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went ahead and implemented this as it wasn't too much work.

@ed7coyne
Copy link
Collaborator Author

Added the Portal.{h,cc} changes in here as well. Seemed easier since dependent PRs are hard to parse (too much noise).

@proppy
Copy link
Contributor

proppy commented Oct 28, 2016

oh nooo :)

@ed7coyne ed7coyne changed the title Add Transcriber object. Add Transcriber and Portal objects. Oct 28, 2016
@@ -0,0 +1,112 @@
#include "thing/Portal.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use https://github.com/tzapu/WiFiManager instead or rolling something on our own?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm maybe we could evaluate it at least.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there are issues with what is presented here, let's get this checked in and I will evaluate the WiFiManager this friday and let you know what I think.

@ed7coyne
Copy link
Collaborator Author

ed7coyne commented Nov 1, 2016

Ya smaller PRs are better but I haven't figured out a good workflow for depending PRs yet that aren't a mess to review and merge.

@proppy
Copy link
Contributor

proppy commented Nov 2, 2016

I haven't figured out a good workflow for depending PRs yet that aren't a mess to review and merge.

having them in two different (but dependent) branch and using rebase worked well for me in the past. But LGTM :)

@ed7coyne ed7coyne merged commit c353aaa into FirebaseExtended:master Nov 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants