These are chat archives for SmingHub/Sming

3rd
May 2016
hreintke
@hreintke
May 03 2016 11:52
This message was deleted

@all
Just pushed a "FlashStream_rBoot_FTP" branch to SmingRTOS which includes :

  • Ability to write directly to flash using streams
  • rBoot class (initial version)
  • Updates to FTP server for application & spiffs OTA update
  • Makefile targets for OTA push from eclipse

See added example rBoot_Generic (including readme.txt) for more information.
Comments/Remarks welcome

alon24
@alon24
May 03 2016 13:31
This message was deleted
@hreintke here?
trying to work with mcp23017
MCP23017 mcp;
volatile boolean awakenByInterrupt = false;
byte mcpPinA = 0;
byte interruptPin = 5;

void interruptCallback() {
    awakenByInterrupt = true;
    Serial.println("Interrupt Called");
    while (!(mcp.digitalRead(mcpPinA)));
}

void init()
{
    Serial.begin(115200); // 115200
    Serial.systemDebugOutput(true); // Debug output to serial
    Wire.pins(sclPin, sdaPin);

    mcp.begin(0);
    mcp.pinMode(8, OUTPUT);
    mcp.pinMode(9, OUTPUT);
    mcp.pullUp(8, HIGH);
    mcp.pullUp(9, HIGH);
    mcp.digitalWrite(8, LOW);
    mcp.digitalWrite(9, HIGH);

    pinMode(interruptPin, INPUT);
    pullup(interruptPin);

    mcp.setupInterrupts(true, false, LOW);
    mcp.pinMode(mcpPinA, INPUT);
    mcp.pullUp(mcpPinA, HIGH);
    mcp.setupInterruptPin(mcpPinA, FALLING);
    attachInterrupt(interruptPin, interruptCallback, FALLING);
}
@hreintke this code basically should make all of A side an input, call interupt on mcpPinA side, to regular Interrput? - how do I make this work?
using RTOS, shouild I use :
This message was deleted
alon24
@alon24
May 03 2016 13:36
typedef enum {
    GPIO_PIN_INTR_DISABLE = 0,      /**< disable GPIO interrupt */
    GPIO_PIN_INTR_POSEDGE = 1,      /**< GPIO interrupt type : rising edge */
    GPIO_PIN_INTR_NEGEDGE = 2,      /**< GPIO interrupt type : falling edge */
    GPIO_PIN_INTR_ANYEDGE = 3,      /**< GPIO interrupt type : bothe rising and falling edge */
    GPIO_PIN_INTR_LOLEVEL = 4,      /**< GPIO interrupt type : low level */
    GPIO_PIN_INTR_HILEVEL = 5       /**< GPIO interrupt type : high level */
} GPIO_INT_TYPE;
hreintke
@hreintke
May 03 2016 13:49
@alon24 :
This is the snippet of my code for interrupt handling :
    attachInterrupt(5, interruptCallback, (GPIO_INT_TYPE)2);

//    ti = new QueuedInterrupt(5,(GPIO_INT_TYPE)2,qihandler);

    mcp->begin(0);
    mcp->setupInterrupts(true, false, LOW);
    mcp->pinMode(7, INPUT);
    mcp->setupInterruptPin(7, CHANGE);
alon24
@alon24
May 03 2016 13:59
what is pin 5 doing attachInterrupt(5
is it related to mcp?
hreintke
@hreintke
May 03 2016 14:18
Pin 5 is the esp pin which handles the interrupts from mcp.
alon24
@alon24
May 03 2016 14:19
wait, what do i connect to pin 5? (gpio5) - something from mcp? I tought need to connect only i2c (scl, sda)
or is it like a passthough?
hreintke
@hreintke
May 03 2016 14:27
The mcp has two "interrupt pins" from mcp point of view they are output.
When a "regular mcp pin" which has interrupt enables triggers, the "mcp interrupt pin" triggers.
You connect the "mcp interrupt pin" to an esp pin. In my case GPIO5.
alon24
@alon24
May 03 2016 14:41
oh ok, @robotiko says I can poll too
hreintke
@hreintke
May 03 2016 14:46
Sure you can. That is the same as on esp. I tested with polling and interrupt. Both work.
One of the reasons I made the QueuedInterrupt, then I should be able to use the same interface when using interrupts from esp or mcp.
robotiko
@robotiko
May 03 2016 14:47
@alon24 you shoudl consider .. that with the extra pins that mcp give you.. "waste" oen fo interrupt.. might be doable ;)
alon24
@alon24
May 03 2016 14:53
i see this reasoning
robotiko
@robotiko
May 03 2016 14:55
with mcp .. you don't need to be a gpio gollum
hreintke
@hreintke
May 03 2016 14:56
That is my idea too. One interrupt pin on esp can handle up to 16 mcp interrupt enabled pins. When an "esp interrupt" triggers, you read the pin and value using I2C from mcp
alon24
@alon24
May 03 2016 15:52
MCP23017 *mcp;
volatile boolean awakenByInterrupt = false;
byte mcpPinA = 7;
byte interruptPin = 5;

void interruptCallback() {
    awakenByInterrupt = true;
    Serial.println("Interrupt Called");
    while (!(mcp->digitalRead(mcpPinA)));
}
....
inti{
attachInterrupt(interruptPin, interruptCallback, (GPIO_INT_TYPE)2);
    mcp = new MCP23017();

    mcp->begin(0);
    mcp->setupInterrupts(true, false, LOW);
    mcp->pinMode(mcpPinA, INPUT);
    mcp->setupInterruptPin(mcpPinA, CHANGE);

...

}

am i right to assume that if I click on a button connected to GPA7 (on mcp right side top one), it should print something ???

(Does not work for me)
I connected mcp pin 20 (INTA) to esp-gpiio5
hreintke
@hreintke
May 03 2016 18:08
On first sight : yes that is what I expect to happen.
I remember having similar issue when I started. In my testapp now I have a debugf("...") which outputs.
Don't know I what I updated to make it work, but for sure it works.
My testing went to identifying "speed of interrupt processing". Understanding at what rate interrupts are processed correctly without loosing one. So I went to setting esp pins high/low in the interrupt routine and checking timing with my logic analyzer.
Just to ask the obvious. You see the correct connectivity between esp & mcp when polling ?
That is where most of my initial effort went into.
alon24
@alon24
May 03 2016 18:31
I jump straight to interrupt, did not do polling
Will try polling next
jasperachtbaan
@jasperachtbaan
May 03 2016 18:56
Hello, I'm trying to call a function in my main code (the application.cpp) from an html button or javascript. I really don't know how to start with this. Does anybody havr a suggestion??
Thanks in advance
HappyCodingRobot
@HappyCodingRobot
May 03 2016 19:27
@jasperachtbaan for that take a look at the Basic_WebSkeletonApp or the MeteoControl. There you can find examples for POST and GET request
s
jasperachtbaan
@jasperachtbaan
May 03 2016 19:33
Okay thanks a lot!
Mateusz Zakarczemny
@Matzz
May 03 2016 20:34
@hreintke
@Matzz : It is better to show the differences than pointing to the complete file. Could you do that ?
Diff shows some refactoring but also different way of storing keys and values:
http://www.mergely.com/h04WkAOA/
hreintke
@hreintke
May 03 2016 21:19
@Matzz :
What I see is that most of the changes were already in with the initial load of Sming.
With only adding a clear() function afterwards.
Don't know why the change in keys/values was done. That is not documented.
What are the issues you have with the Sming version ?
jasperachtbaan
@jasperachtbaan
May 03 2016 21:27
By the way, is it possible to make the 8266 act as a websocket client? I can't find it in the sming framework. I am trying to set up a low latency full duplex communication between two 8266's.