Avatar for maze1980


Member since Jun 2019 • Last active Mar 2023
  • 7 conversations

Most recent activity

  • in ESP8266
    Avatar for maze1980

    Your Adruino code looks complicated, and I'm not sure if it's correct, or if you're overwriting the variable IncomingString in the while loop.

    The sample code for serial input from https://www.javatpoint.com/arduino-seria­l-available:

    void loop( ) // loop function that executes repeatedly  
    if(Serial.available( ) > 0) //  It will only send data when the received data is greater than 0.  
    arrivingdatabyte = Serial.read( );  // It will read the incoming or arriving data byte  
    Serial.print("data byte received:");  
    Serial.println(arrivingdatabyte, DEC); // here, DEC means Decimal  

    I'd suggest to remove the while and the true/false in your code, and change it according to the sample code.

  • in ESP32
    Avatar for maze1980

    Well, optimizing for speed is often bad for readability. I wouldn't add "+0.5" to the code, just to save the time needed for this extra operation.
    And yes, numbers in square brackets are not rounded to an integer. And we all love code like this:

    >foo={"0.5": "bar", "1": "foo"};

    Since prepareDisplay is one of the slowest functions: ColorMap has only 8 different values, Temperature has 208 different values - so it might be feasible to pre-compute things and avoid all division and multiplication operations with Temperature in this function - if there's enough RAM available on the ESP32. Anyway, that's much harder than just removing rounding and clamping for TemperatureMap values. Removing 262 function calls will result in a measurable improvement, even for the compiled version.

  • in ESP32
    Avatar for maze1980

    Just looked at the code, and I think there are still options for improvement: All the clamping and rounding for TemperatureMap values can be omitted:

    >let foo = new Uint8ClampedArray(3);
    =new Uint8ClampedArray(3)
    >foo[0] = -0.5; foo[1] = 1.5; foo[2] = 255.5;
    =new Uint8ClampedArray([0, 1, 255])

    One day I'll test this code, I think the effect will be nice.

  • in ESP8266
    Avatar for maze1980

    "wpa2" should work
    "wpa and wpa2" could cause problems
    WiFi 6 could cause problems

  • in ESP8266
    Avatar for maze1980

    I don't think it is easy to fix, especially without breaking existing code. Maybe it is possible to change

    digitalPulse(csPin, true, [1, 1, 0.03, 0.03, 0.045]);


    digitalPulse(csPin, false, [1, 0.03, 0.03, 0.045]);

    and get the desired pulse, just a a little delay. Then there would be no code change required, just a note in the documentation.

  • in ESP8266
    Avatar for maze1980

    The neopixel module for ESP8266 does a dry-run/pre-roll without emitting any pulses. That dry run is necessary to load the machine code from flash into RAM. Without this dry run the timing of the pules representing the first byte won't have proper timing. It might be the same issue in this case. Reference files:
    jswrap_neopixel.c, line 220...
    jswrap_io.c, line 201...

    There is no dry-run for ESP8266 in jswrap_io.c, so I would assume it is the same issue. That code is not capable of producing very short pulses accurately in the first run.

  • Avatar for maze1980

    A simple FET switch might be all thats needed to turn off the juice to the Neopixel hogs or a relay as indicated in post #2 What about using a pin on the Espruino to control a Buck step-up converter that would supply the 5V? hummmmmm . . . .

    Neopixel shall be connected with ground first, i.e. a simple FET wouldn't be a good solution. Get a high rail FET, e.g. MIC94060 or something else with an internal charge pump.

  • Avatar for maze1980

    I see console.log("doing stuff"); in your code, but no serial port connected on the picture. Do you have data waiting at the serial port?

  • in Pico / Wifi / Original Espruino
    Avatar for maze1980

    According to the first post the battery dies after one hour. Then illuminating 10 LEDs for a minute will work for 60 times (that is again 60 minutes) until the battery dies. Is this enough?
    What do you actually build, with 300 LEDs and portable (I guess, as it is battery powered)?