Avatar for Christof550

Christof550

Member since May 2018 • Last active Aug 2019
  • 6 conversations
  • 25 comments

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Christof550

    haa ok ! I'll add a line terminator for each line of codes.
    Yes, it's because . i create a string variable in my program for the entire puck JS script to upload.

    Thanks.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Christof550

    @Gordon yes it's the only new line \n

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Christof550

    Thanks all of you, i 'll try your advice soon.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Christof550

    Ok thank you, i'll remove "notify(0)" and will try to update firmware .
    I upload the script with noble in node.js program, i'm not using the WEB IDE or Espruino program,
    i thought the function to save the script to ram was "save()" .
    I want to keep the script after reboot.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Christof550

    a few weeks ago, the battery lost all its power from ~90% to ~20% then i changed it today and impossible to scan the puck button.
    After changing the battery , the green led flash started sometimes when i click the button .

    I have hard reseted but the problem persist.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Christof550

    Hi,
    My puck.js not advertising anymore, i have changed the battery then the green led flash 5 times sometimes when i click the button.
    In a few weeks, The old battery has suddenly lost all its power from ~90% to ~20%.

    When the battery has died, i changed it with a the same new then impossible to scan it and these flashes started..

    What's the meaning of green led flashing ?

    Thanks!

    here the script uploaded :

    `reset();
        echo(0);
        notify(0);
        clearInterval();
        clearWatch();
        var presses=0;
        var timeoutDoubleClick = null;
        var nbClick = 0;
        var activeDebug = "";
        var releasedTime = 0;
        var timeoutReleased = null;
        var switchMode = null;
        var low = 0;
        var state = {press : false, release : false};
        var batteryLevel = 0;
        
        setWatch(function() {
            state.release = true;
            state.press = false;
            
            if(releasedTime){
                activeDebug = "d";
                LED.set();  
            }else{
                activeDebug = "";
            }
            nbClick++;
            if (!timeoutDoubleClick) {
                timeoutDoubleClick = setTimeout(function(){ 
                    timeoutDoubleClick = null;
                    NRF.setAdvertising({},{
                        interval:150,
                        manufacturer:0x0590,
                        manufacturerData:activeDebug+"clk-"+pres­ses+"-"+nbClick+"-${scriptVersion}-"+bat­teryLevel
    
                    });
                    nbClick = 0;
                }, 500);
            }
            if (nbClick > 1) {
                clearTimeout(timeoutDoubleClick);
                timeoutDoubleClick = null;
    
                NRF.setAdvertising({},{
                    interval:150,
                    manufacturer:0x0590,
                    manufacturerData:activeDebug+"clk-"+pres­ses+"-"+nbClick+"-${scriptVersion}-"+bat­teryLevel
                });
                nbClick = 0;
            }
            if(presses > 98){
                presses=0;
            }
            presses++;
            
          }, BTN, {edge:"falling", debounce:20, repeat:1});
        setWatch(function(){
            state.release = false;
            state.press = true;
            if(timeoutReleased){clearTimeout(timeout­Released);}
            timeoutReleased =  setTimeout(function(){
                timeoutReleased = null;
                if(!state.release){
                    releasedTime = !releasedTime;
                    var flicker = 0;
                    switchMode = setInterval(function(){
                        LED.set();
                        flicker++;
                        setTimeout(function(){
                            LED.reset();
                        },150);
                        if(flicker == 3){clearInterval(switchMode);}
                    },300);
                }
            },10000)
            LED.set();
            if(!activeDebug){
                LED2.reset();
                LED3.reset();
            }
            LED.reset();
        }, BTN, {
            edge:'rising',
            repeat:1,
            debounce:20
        });
        LED1.set();
        function sendBatteryInfo(){
                batteryLevel = Math.round(E.getBattery());
                if(batteryLevel < 20){ low = 1;}
        }
        sendBatteryInfo();
        setInterval(sendBatteryInfo,60 * 60 * 1000);
        save();\n`
    
Actions