These are chat archives for esp8266/Arduino

21st
Jan 2016
Sven Eliasson
@comino
Jan 21 2016 00:21
Someone tweaked SSL/axtls for lower ram consumption?
gonsays
@gonsays
Jan 21 2016 00:21
hey guys, how are you?
gonsays
@gonsays
Jan 21 2016 00:28
can you guys give me your opinion about NodeMCU lua vs. Arduino IDE?
Sven Eliasson
@comino
Jan 21 2016 00:36
Hey you ! Forget about NodeMCU ;)
Aditya Tannu
@AdySan
Jan 21 2016 00:36
use whatever you're comfortable with Lua scripts or C++ style Arduino sketches
Chris Elsworth
@celsworth
Jan 21 2016 00:54
that is the politically correct answer ;)
gonsays
@gonsays
Jan 21 2016 01:15
oh
I've been known that Arduino IDE has a PWM Problem
esp8266/Arduino#836
and I'm using with PWM on RGB LEDs
beikeland
@beikeland
Jan 21 2016 05:42
slightly OT; if using a 1-2 meter onewire bus, would you place pullup at the esp or sensors end? (2x ds18b20)
tzapu
@tzapu
Jan 21 2016 05:44
@skorokithakis mine are still in the post, seems to be taking longer than i would of thought, so 14 days doesn t sound that bad in the end...
Michael Miller
@Makuna
Jan 21 2016 07:41
@celsworth I agree with you about using == 0, as strcmp returns >0, 0, or <0 it makes it clear it's not a boolean.
badigo
@badigo
Jan 21 2016 10:27
Hey guys,
Im experimenting with SSL on the ESP8266 and ran into memory issues. I only want to communicate to my personal server in a first step (so Im flexible on this side). Is there and way to reduce the memory consumption? Maybe reducing the fragmentsize as low as 8kb?
And a question pretty much correleated to that - anyone successfully implemented AWS IoT service?
Helio Machado
@crushedice2000
Jan 21 2016 10:49
Hi! I'm doing a json like this:
"gpio": {
      "led1": {
        "pin": 0,
        "memory": false,
        "enabled": true,
        "inverting": true,
        "value": 0
      },
      "led2": {
        "pin": 2,
        "memory": false,
        "enabled": true,
        "inverting": true,
        "value": 0
      }
    }
What is the better way to load it in c++ to do a lookup by name? Example: analogWrite("led1", 512);
Sven Eliasson
@comino
Jan 21 2016 10:52
If thats your question
Helio Machado
@crushedice2000
Jan 21 2016 10:54
@comino: I've done the parser with this already, my question is how to create a struct or similar for each gpio to get the pin number searching the name (son key)
However, I thank you for you suggestion.
Helio Machado
@crushedice2000
Jan 21 2016 11:08
Why this doesn't works?
#include <map>

using namespace std;

struct io {
  bool inverting;
  bool memory;
  int value;
  int pin;
};

map<String, io> gpios;
Helio Machado
@crushedice2000
Jan 21 2016 11:14
maybe @me-no-dev @mozgy @Links2004 or @celsworth knows what is happening?
Me No Dev
@me-no-dev
Jan 21 2016 11:18
I'm not familiar with maps, but there are more than one way to get something going
like having a pointer to the next io inside the struct and itterate that way
Helio Machado
@crushedice2000
Jan 21 2016 11:20

@me-no-dev:

In file included from src/main.cpp:1:0:
src/main.h:39:1: error: reference to 'map' is ambiguous
map gpios;
^
In file included from src/main.h:3:0,
from src/main.cpp:1:
.pioenvs/esp01_1m/FrameworkArduino/Arduino.h:272:6: note: candidates are: long int map(long int, long int, long int, long int, long int)
long map(long, long, long, long, long);

I don't understand why it doesn't work

Me No Dev
@me-no-dev
Jan 21 2016 11:20
yeah... arduino has map(value, min, max, to_min, to_max)
check Arduino.h
Helio Machado
@crushedice2000
Jan 21 2016 11:21
@me-no-dev: Ooooops, yes. I'll try to avoid that. My bad.
@me-no-dev: std::map works well
Me No Dev
@me-no-dev
Jan 21 2016 11:22
so you ware all sorted out? :)
Helio Machado
@crushedice2000
Jan 21 2016 11:23
@me-no-dev: Now all goes well. Only a last question: Is sane to continuously use std::?
Me No Dev
@me-no-dev
Jan 21 2016 11:26
yeah :) I see nothing insane in doing it
Helio Machado
@crushedice2000
Jan 21 2016 11:27
@me-no-dev:
for(long long int i=0; i<1000000000000; i++) {
  cout << "Thank you!";
}
Me No Dev
@me-no-dev
Jan 21 2016 11:28
for nothing :)
Helio Machado
@crushedice2000
Jan 21 2016 11:29
@me-no-dev: !for nothing :smile:
Me No Dev
@me-no-dev
Jan 21 2016 11:29
:D good one!
bidyutper
@bidyutper
Jan 21 2016 11:32
ir universal remote control similar to apps thts are install in mobile devices via mqtt local broker on rpi any ref. plz
Helio Machado
@crushedice2000
Jan 21 2016 11:33
@bidyutper: Didn't understand you fully. Are you searching a mutt to IR for raspberry pi?
bidyutper
@bidyutper
Jan 21 2016 11:36
ir blaster attch to esp runnin some topic pubsub.....then rpi running mqtt broker....control via mqtt mobile app
somethin like ths
Helio Machado
@crushedice2000
Jan 21 2016 11:40
@bidyutper: So what are you searching the app, the blaster circuit, the mosquitto example?
bidyutper
@bidyutper
Jan 21 2016 11:42
yeah...also mqtt should be local area control...dont need cloud conrol thing...
Helio Machado
@crushedice2000
Jan 21 2016 11:43
@bidyutper: I don't know any example of this. Maybe someone here knows.
Sorry
bidyutper
@bidyutper
Jan 21 2016 11:44
@crushedice2000 kk
Helio Machado
@crushedice2000
Jan 21 2016 11:44
Also, a personal question: What is the English equivalent of this website? http://www.rae.es (extremely fine irony)
bidyutper
@bidyutper
Jan 21 2016 11:48
hmm...use google translater...
Helio Machado
@crushedice2000
Jan 21 2016 11:50
@bidyutper: ¡thnx (didn't leave that mode)
Helio Machado
@crushedice2000
Jan 21 2016 11:57
@/all the savvy people here: How can I keep OTA from allowing firmware change? Only SPIFFS change.
Me No Dev
@me-no-dev
Jan 21 2016 12:07
such feature is not implemented but you can edit ArduinoOTA.cpp and break if it's firmware
not a big deal to be implemented also, but why?
if you are password protected, it's you that should not flash firmware :D
Helio Machado
@crushedice2000
Jan 21 2016 12:20
@me-no-dev: :smile: Ok. I only plan it to do a easily-uploadable SPIFFS image, but avoid firmware change.
Also, how can I cast a ArduinoJson::JsonObjectKey to a char*?
Helio Machado
@crushedice2000
Jan 21 2016 12:26
Found it! I need to cast into (const char*)
Helio Machado
@crushedice2000
Jan 21 2016 12:36
@me-no-dev: Is sane to do this casting (char*)(const char*)g?
Me No Dev
@me-no-dev
Jan 21 2016 12:37
not really :D
use either
Helio Machado
@crushedice2000
Jan 21 2016 12:39
@me-no-dev: I need char*, but the type is const char*
error: invalid cast from type 'ArduinoJson::JsonObjectKey' to type 'char*'
Me No Dev
@me-no-dev
Jan 21 2016 12:42
then (char*)key
Helio Machado
@crushedice2000
Jan 21 2016 12:43
@me-no-dev: That error happens then.
Helio Machado
@crushedice2000
Jan 21 2016 13:15
I there any way of putting a input/output in inverting mode?
Chris Elsworth
@celsworth
Jan 21 2016 13:16
what's inverting mode?
Helio Machado
@crushedice2000
Jan 21 2016 13:16
This message was deleted
Chris Elsworth
@celsworth
Jan 21 2016 13:17
if you mean it goes LOW when you tell it to go HIGH .. then no, you fix that sort of thing in your own code?
Helio Machado
@crushedice2000
Jan 21 2016 13:17
@celsworth: Ok, I'll do in my code.
Chris Elsworth
@celsworth
Jan 21 2016 13:19
void digitalInvertedWrite(uint8_t pin, uint8_t val) {
  digitalWrite(pin, val == HIGH ? LOW : HIGH);
}
simple enough ;) entirely untested, don't see why it wouldn't work tho.
Helio Machado
@crushedice2000
Jan 21 2016 13:19
@celsworth: Good, thanks! I can set the pin seamlessly :smiling_imp:
Chris Elsworth
@celsworth
Jan 21 2016 13:19
oh, probably want pin in there :D
edited ;)
Me No Dev
@me-no-dev
Jan 21 2016 13:24
or digitalWrite(pin, !val);
Chris Elsworth
@celsworth
Jan 21 2016 13:24
always with the simple way me-no-dev ;)
yeah actually I dunno why I didn't suggest that. still early ;)
Me No Dev
@me-no-dev
Jan 21 2016 13:25
prolly :) I could hove come up with your solution as well
Chris Elsworth
@celsworth
Jan 21 2016 13:25
I always overengineer :D
Me No Dev
@me-no-dev
Jan 21 2016 13:25
but was out in the cold
Chris Elsworth
@celsworth
Jan 21 2016 13:26
needs login
tzapu
@tzapu
Jan 21 2016 13:26
ah
sorry
slack_for_ios_upload_1024.jpg
Helio Machado
@crushedice2000
Jan 21 2016 13:27
@me-no-dev: Cool!
tzapu
@tzapu
Jan 21 2016 13:27
impossible tiny
i ll need to enlarge the holes as well
@skorokithakis your babies are here :P
Chris Elsworth
@celsworth
Jan 21 2016 13:28
@skorokithakis is going into mass production? :D
Helio Machado
@crushedice2000
Jan 21 2016 14:26
@/all: Why it there a ld collect error while using map?
.pioenvs/esp01_1m/src/main.o:(.text._ZNSt8_Rb_treeI6StringSt4pairIKS0_2ioESt10_Select1stIS4_ESt4lessIS0_ESaIS4_EE16_M_insert_uniqueIS1_IS0_S3_EEES1_ISt17_Rb_tree_iteratorIS4_EbEOT_[std::pair >, bool> std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert_unique >(std::pair&&)]+0x0): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
.pioenvs/esp01_1m/src/main.o:(.text._ZNSt8_Rb_treeI6StringSt4pairIKS0_2ioESt10_Select1stIS4_ESt4lessIS0_ESaIS4_EE16_M_insert_uniqueIS1_IS0_S3_EEES1_ISt17_Rb_tree_iteratorIS4_EbEOT_[std::pair >, bool> std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert_unique >(std::pair&&)]+0x4): undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
.pioenvs/esp01_1m/src/main.o: In function `std::pair >, bool> std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert_unique >(std::pair&&)':
main.cpp:(.text._ZNSt8_Rb_treeI6StringSt4pairIKS0_2ioESt10_Select1stIS4_ESt4lessIS0_ESaIS4_EE16_M_insert_uniqueIS1_IS0_S3_EEES1_ISt17_Rb_tree_iteratorIS4_EbEOT_[std::pair >, bool> std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert_unique >(std::pair&&)]+0x4f): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
main.cpp:(.text._ZNSt8_Rb_treeI6StringSt4pairIKS0_2ioESt10_Select1stIS4_ESt4lessIS0_ESaIS4_EE16_M_insert_uniqueIS1_IS0_S3_EEES1_ISt17_Rb_tree_iteratorIS4_EbEOT_[std::pair >, bool> std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert_unique >(std::pair&&)]+0xb6): undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
collect2: error: ld returned 1 exit status
scons: *** [.pioenvs/esp01_1m/firmware.elf] Error 1
========================= [ ERROR ] Took 1.08 seconds =========================
Me No Dev
@me-no-dev
Jan 21 2016 14:31
I think this error means that the definitions are there in the headers (since you got that far) but the implementations are missing from the libs/c code
Helio Machado
@crushedice2000
Jan 21 2016 14:39
@me-no-dev: So, what can I do (if any)?
Chris Elsworth
@celsworth
Jan 21 2016 14:40
where is this Rb_tree stuff coming from?
Me No Dev
@me-no-dev
Jan 21 2016 14:42
@crushedice2000 this the first time you try to compile a map on the esp?
Helio Machado
@crushedice2000
Jan 21 2016 14:42
@me-no-dev: It compiles well until I try to fill the map.
gpios.insert(std::pair<String,io>(String(gpio.key),current_gpio));
Me No Dev
@me-no-dev
Jan 21 2016 14:43
that is when you call a method that requires those missing functions
so better scrap the idea for maps :)
Chris Elsworth
@celsworth
Jan 21 2016 14:44
someone needs to port a red-black tree library to esp ;)
Helio Machado
@crushedice2000
Jan 21 2016 14:44
@me-no-dev: Alternatives?
Me No Dev
@me-no-dev
Jan 21 2016 14:58
this is how I've been solving my similar issues lately

class IO {
  public:
    bool inverting;
    bool memory;
    int value;
    int pin;
    IO *next;
    IO(int gpio, int val, bool inv, bool mem)
    :inverting(inv)
    ,memory(mem)
    ,value(val)
    ,pin(gpio)
    ,next(NULL)
    {}
};

IO *ioArray = NULL;

IO *getIoByPin(int pin){
  if(ioArray == NULL)//NO GPIOs ADDED
    return NULL;
  IO *io = ioArray;
  while(io != NULL){
    if(io->pin == pin)
      return io;
    io = io->next;
  }
  return NULL;
}

void addIo(int pin, int val, bool inv, bool mem){
  if(ioArray == NULL)
    ioArray = new IO(pin, val, inv, mem);
  else {
    if(getIoByPin(pin) != NULL)
      return;//already have it
    IO *io = ioArray;
    while(io->next != NULL) io = io->next;
    io->next = new IO(pin, val, inv, mem);
  }
}
should maybe check if not already in the array when adding but overall that's how I manage "arrays" of objects
you can have a simple array if it will have constant size
Chris Elsworth
@celsworth
Jan 21 2016 15:00
I don't get how that while loop in getIoByPin works?
it looks like it'll loop forever
Me No Dev
@me-no-dev
Jan 21 2016 15:01
yes!
good catch
poor me :D
ZaPpInG
@lrmoreno007
Jan 21 2016 15:32
This message was deleted
ZaPpInG
@lrmoreno007
Jan 21 2016 15:38
@anwarhahjjeffersongeorge yes, it's a cabinet of metal but in the cabinet are many relays and other stuff. @d-anders power supply is: https://upload.wikimedia.org/wikipedia/commons/b/b5/Fuente_de_alimentacion_con_LM317.png but C1 is 2200microF
Helio Machado
@crushedice2000
Jan 21 2016 15:42
@celsworth @me-no-dev: Isn't that so overkilling for a gpio array?
Me No Dev
@me-no-dev
Jan 21 2016 15:42
it all depens on what you want to do
typedef struct {
  bool inverting;
  bool memory;
  int value;
  int pin;
} io_t;

io_t ioArray[10]; //you know you'll have 10

io_t *ioUnknownArray; //use malloc/new
size_t ioUnknownArrayItems = 0; //keep count so you can iterate
much simpler
Helio Machado
@crushedice2000
Jan 21 2016 15:43
@me-no-dev: This seems better.
Me No Dev
@me-no-dev
Jan 21 2016 15:43
but if dynamic, you need to alloc the new size and move stuff over then add the new
if static, the above is fine
ZaPpInG
@lrmoreno007
Jan 21 2016 22:01
@d-anders If I connect the esp8266 to a power supply http://uk.rs-online.com/largeimages/R6842992-02.jpg everything go OK, but if I connect something in the same electric extension socket the esp8266 restart.
need help :worried:
Chris Elsworth
@celsworth
Jan 21 2016 22:08
sounds like you need better bypassing
add more caps :)
I'm currently messing with powering an esp8266 from a 3.3v powersupply and it seems to have so much buffering I can actually turn it off at the plug for a second, then back on, and the esp doesn't reboot :)
must be a huge cap inside it :)
ZaPpInG
@lrmoreno007
Jan 21 2016 22:14
I think it is a professional power supply. It must have enough capacitors inside.
Chris Elsworth
@celsworth
Jan 21 2016 22:15
untrue
you need caps close to the esp
its one of the key requirements of an esp really, good bypassing. they're very fussy about power :/
ZaPpInG
@lrmoreno007
Jan 21 2016 22:18
In the ESP8266 side I've a 100n ceramic capacitor as is recommended
excuse my english I'm spanish, and it's very difficult for me.
Sven Eliasson
@comino
Jan 21 2016 23:12
way to few - less than 20µF I get problems
Me No Dev
@me-no-dev
Jan 21 2016 23:34
100n is a decoupling capacitor (did I spell that even close)
it's purpose is different
you need a storage capacitor
:D
gonsays
@gonsays
Jan 21 2016 23:42
Hello guys!
I have an ESP8266 with NodeMCU firmware
which firmware do I need in order to work with Arduino IDE?