Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Me No Dev
@me-no-dev
int is not the same
sticilface
@sticilface
ok... that might be where the issue is..
Me No Dev
@me-no-dev
word, size_t, things like that are platform dependent
sticilface
@sticilface
i guess enum is too
Keith Andrew Hill
@vic10us
uint_8 or uint_16 bit etc
sticilface
@sticilface
float?
Keith Andrew Hill
@vic10us
Floats are dangerous.
And mostly unnecessary as you can represent them (with some mi
Minor loss of resolution) via conversion to an int by multiplying them by some large value.
123.123 could be multiplied by 1000 to result in 123123
Google does this for example to solve for currency storage by multiplying the original value by 1000000
sticilface
@sticilface
ah that makes sense.
thanks
Keith Andrew Hill
@vic10us
The other standards to look into are BSON and MessagePack.
sticilface
@sticilface
what about signed versions like int8_t... etc
Keith Andrew Hill
@vic10us
Those are essentially stored the same way. The only difference is the lsb or msb in memory.
I almost never use signed int value as negative numbers are usually undesirable
Especially when dealing with security
At least in transit
sticilface
@sticilface
cool thanks... i think what i'll do is use the standard numbers... should work
see how i get one....
message pack looks interesting though
geman220
@geman220
Does anyone here have experience with the Wiced Feather?
Michael Miller
@Makuna
@sticilface the other issue to be concerned with is if you have a structure that has uint16_t followed by a unint32_t; is the size of the struct 6 or 8 bytes? Both lengths are valid, to make it more standard you will have to wrap your struct with a #pragma pack (push,1) and then a #pragma pack(pop) to make sure the structure is packed by bytes. For enums, you should be able to define them typed like
enum MyEnum : uint8_t
{
    value1,
   value2
}
Stavros Korokithakis
@skorokithakis
does this library look at all useful to anyone? https://gitlab.com/skorokithakis/esp-boilerplate
geman220
@geman220
@skorokithakis I have a quick question for you if you don't mind.
Stavros Korokithakis
@skorokithakis
sure
geman220
@geman220
So I wanted to get started on at least prototyping the MQQT servo project. I ordered a WICED Feather on Amazon and it got here today. Adafruit's website says "You write your code in the Arduino IDE using the same standard libraries you've always used (Wire, SPI, etc.), compile locally, and the device is flashed directly from the IDE over USB." Except it doesn't support Servo.h....... Anyway, I got MQTT to work and I can do a simple test to have it Serial.print a message depending on what is posted to the broker. I actually have 2 questions. 1) For some reason this program is just eventually disconnecting from the MQTT broker and I have to reboot the device to have it connect again. 2) Whenever I can actually get a servo hooked up, it should just be as easy as replacing the Serial.print with the servo infromation, correct?
Stavros Korokithakis
@skorokithakis
hmm, does the feather have an ESP?
geman220
@geman220
No it doesn't but I was just using it as a stop gap to try and hammer out the code and functionality so when my ESPs get here I can just load up some code (save a few changes).
I specifically looked for something that claimed to support all default libraries... I'm getting very fed up with Adafruit for a few reasons -.-
Stavros Korokithakis
@skorokithakis
not sure man :/ should have gotten a huzzah
geman220
@geman220
Sold out wouldn't have fixed my gap =(
Stavros Korokithakis
@skorokithakis
ah :/
geman220
@geman220
Any idea why the MQTT is disconnecting? Is there a keepalive or loop I should be running?
Stavros Korokithakis
@skorokithakis
have a look at my library above, it has a working mqtt example
there's a loop afaik, yeah
Keith Andrew Hill
@vic10us
Why doesn't ESP need the loop method? I thought you could make everything event driven like in LUA?
I meant DOES
Stavros Korokithakis
@skorokithakis
not sure how lua works :/
Keith Andrew Hill
@vic10us
Isn't the ESP multithreaded?
Stavros Korokithakis
@skorokithakis
not that i know of
Michael Miller
@Makuna
Arduino is not multithreaded, and this is an Arduino environment. If you want "true" multithreaded support you won't be working in Arduino. If your Ok with "non-preemptive" and want to remain with Arduino, I have a task library (github/makuna/task) that is cross Arduino supported and I also believe the included Ticker library also provides similar functionality.
@vic10us Don't confuse a hardware platform (Esp8266) with a Dev Environment (Arduino).
Event Driven doesn't mean multithread either. Generally "async" programming models are "event driven" models. While most Arduino libraries or features are not "async" due to historic reasons around complexity and target audience of Arduino, with a little work they could be. I personally prefer async.
tzapu
@tzapu
@skorokithakis you know what would look nice in your boilerplate? WiFiManager to handle all the wifi configuration, maybe mqtt server, ntp server as well at setup time :D
Lars Englund
@larsenglund
@igrr @me-no-dev a solution has been found for the NMI problem! :smile: larsenglund/esp8266_arduino_nmi_timer#1
Stavros Korokithakis
@skorokithakis
@tzapu What do you mean? That's literally all it does.
sticilface
@sticilface
@Makuna that makes a lot of sense. And maybe why I was still getting variable sizes just using standard sizes. Will report back. Thanks.
Me No Dev
@me-no-dev
@larsenglund nice find! elegant solution as well :)