-
Hi,
a) Well other options are not always remembered: the minification options for instance are more or less randomly saved, and so does the time set option.b) Ok, so this is a feature reserved to the native application: I use the linux one on Ubuntu 16.04.
c) It's just disapointing and onec I got used, yet some thing to do manually. By the way, I would greatly appreciate having an otion to peridically save the source AND journalise those saves (git commits with automatic commit comment would be nice). I guess, reading your answer, that it won't happen unfortunately.
Thank's for your answer.
-
Hi,
I would like to share this as I had some difficulties some weeks ago and got out of trouble using this:Here is a recipe to extract the class definition of an object in the console pane.
I used it on a running Espruino Pico which had an objet stopwatch.runningOnStats saved but could not get its source defintion from dump().
It was no more available in the WebIde editor pane because I had wiped it and saved without seeing this before... So I had lost all of the source code for the class runningOnStats property of stopwatchIn the following case, stopwatch.runningOnStats is the object which we want to get the defintion on the console.
We will have to copy/paste/edit the result from the console to get it in a source formvar rs=Object.getPrototypeOf(stopwatch.runningOnStats); for (var p of Object.getOwnPropertyNames(rs)) { console.log(p); console.log(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(stopwatch.runningOnStats), p)); }
The attached file is a more explicit result and execution trace of what this gave to me.
-
Hi, this is an old thread, however, I face some difficulties with the WebIde as a Chrome application and just the https://www.espruino.com/ide/.
Here are what they are:
a- In the WebIde settings>Communications, I have to reselect the last option "Set current time" each time the WedIde is restarted from Android. It seems, it is not saved in this configuration.
b- The "Project directory for sandbox" button in Settings>Project doesn't display any select box.
It gets darker a few 1/10 of a second each time i press it. Again that's on Android through the Chrome application and the web served ide https://www.espruino.com/ide/.
c- Saving (disquette button) displays a disturbing "download" message and doesn't let me choose the file name. I get a code(some number).js file in my download directory.My Android version is 7.0.
I was wondering if there could be some "hidden setting" to properly setup in Chrome?
Thanks for your attention.
-
Thanks,
Yes, I had forgotten about decimals beeing rounded somewhere when transformed into binaries.So I tested the second solution and it works.
I totally agree with the no bug approach. The trick is that it's a silent killer. As well as dynamic typing is indeed.
However, the value of v is continuous (risk level in probability) so the exact comparison done by Array.indexOf was not my need.
I finally settled on Array.findIndex as I can get an index through a comparison function even if the value is really not in the array but rather in between values in the array. My array is sorted in increase order.
And this came from your first answer. tab1mAlpha.findIndex(a=>Math.abs(a-v)<0.000001)This page provides the formulas and statistics tables from which I extracted the 2 arrays below...
That gave me:// approximately computes the xhi2 of 2 degrees of liberty value for alpha risk function xhi2_2(alphaRisk) { var idx = [0.05, 0.1, 0.2, 0.3, 0.5, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999].findIndex(elt => elt>=(1-alphaRisk)); return [0.10, 0.21, 0.45, 0.71, 1.39, 2.41, 3.22, 4.61, 5.99, 9.21, 13.82][idx]; }
Thank's again for your reactivity and commitment to understand our questions!
-
Hi @Gordon,
While trying to do some statistics, I found that situation on a v2.00 upgrade Pico:
>var tab1mAlpha = new Array( 0.05, 0.1, 0.2, 0.3, 0.5, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999); =[ 0.05, 0.1, 0.2, 0.3, 0.5, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999 ] >console.log(tab1mAlpha.indexOf(v)) -1 =undefined >v =0.95 >typeof v ="number"
However, using the test box in the mozilla page, I got
var tab1mAlpha= [0.05, 0.1, 0.2, 0.3, 0.5, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999]; var v=1-0.05; console.log(tab1mAlpha.indexOf(v)); console.log(typeof v);
which once run showed:
> 8 > "number"
So, is this a bug or I am not understanding something?
P.S.: Should I report this type of problem on the forum or in github?
-
Thanks for your help, it did worked and I globally saved some time AND events stack depth.
Now I don't have to separate in time, by emiting events, concatenation, slicing and storing from the Serial.on handler: it just happens fast enough without throwing any event to my Gps object.
In some cases, I could receive enough messages and emit one event per messages, which stopped the program with strange corrupted data in the line received. The result was a buffer way too long (32Kb) and other mysterious unvalid gps data.Now, I am more on 2 colateral problems:
1-one in Javascript (Serial.pipe chunk parameter in order to limit the number of calls to handler of the input data and get at least any message header at once),
2-one in hardware (Pico powered by 3.7 V battery, deep sleeping as long as possible, using the B0 mosfet with the supplied 3.7 V)So I think we are far enough of flat strings and should open 2 other threads to handle those points.
Thanks again!
-
Hi,
As a complementary question to those flat strings handling, I wonder if there is an efficient way to store a standard string (coming from usart for instance) to a pre-allocated flat string without using looping technics?.
This is in order to avoid the allocation time each time my pico receives some complete data packets.More explicitely, the pico receives some data from usart.
These chuncks are concatenated in Serial.on('data',...) event handler.
So far, these are standard javascript strings.
Once there is enought data, it is sliced and can then be used in a flat string to create an ArrayBuffer resliced itself and finally accessed internally through a Dataview.The thing is an Ublox M8U gps device using their binary protocol: very c structs friendly and only bytes/words/long words properly aligned. You can see this to get a clear idea. Here, the interest is that payloads are almost all of a fixed length (DMA in sight), very compact (less bytes on usart fro more data) and no fancy sexagesimally odd computations on latitudes/longitudes and so on!
My goal is to preallocate a few different dataviews of predefined length and then copy the incoming data from its string format to the dataview after all checksums and length controls of course.
The gps data will be accessed through getters using v.getUint32(buffer, true) and others as usual with dataviews.A side approach would be to use inline C for setters and getters but what in Espruino (javascript)?
A dream would be to receive data from serial to an ArrayBuffer (kind of DMA) and only wake up when the serial buffer has enough bytes to analyse: so sleep walking while the interpreter is in deep sleep mode.
-
Hi,
All of this is why I do use LiFePo4 batteries after, as far as possible, any ldo.
You just don't need them as the batteries will go down from 3.6 V to 3.1 V and charging, as I do it, is at 3.65 V max out of the circuit (removing it from the project and charging separately).
This becomes very important when your main power consumption device is finally close to the ldo quiescent amperage...
Now, some peripherals do have an ldo integrated, and it can be a problem as the LiFePo4 batteries wil dye at 3.1 V while the ldo will reduce its supplied voltage by 0.25 V easily. Not to talk about secondary batteries, poorly designed, which are consuming 13 mA almost permanently. Drones don't care much about nA while we do in this case! -
Hi,
Thanks again: the gps has its own voltage regulator so I am just using it as is with the mosfet switching it on & off from time to time.
I expect to use a cheap non protected battery design to recharge a smartphone with a usb connector on its output and a micro usb for recharging it from main. This won't happen while the pico is inserted in the battery. -
-
-
Hi,
I'd like to use the mosfet of the pico to control power of a GPS (60 mA at 3.3V, 5V tolerant, own ldo regulator integrated).
So, I got confused somehow from the documentation...
That is, after bridging the jumper B0/Fet, I should use the example provided here we havedigitalWrite(B0,1); // Partially turn on the 'Bat' output (this produces 3.3v on the FET, meaning it has just 1.4v between Gate and Drain) digitalRead(B0); // turn off the output (also check if USB powered)
a-Does that mean that I will get a 3.3V on VBAT?
b-What would be the max amperage in this case?
c-Would the mosfet get hot?
d-On this Pinout, which pin should I use to connect a load that will be powered through B0 controlled mosfet : VBAT, BAT_IN?As a separate problem, I need to connect the GPS on a UART AND an I2C (addtionnal sensor here).
e-What would the best pins to use: B6 & B7 for UART, which ones for I2C?Thank's a lot.
-
-
Hello,
So I did started a 3D model of the Pixl.js based on the Eagle files.
So far it's more or less complet and accurate.
See it below:// Written in 2018 by Alain Sézille // Any license defined in the librairies used rule their use herein // Any license about the Pixl.js board is applyable // The following termes apply exclusively to my own work and do not overrule any other licenses and copyrights for the components and informations used below // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to the // public domain worldwide. This software is distributed without any // warranty. // // You should have received a copy of the CC0 Public Domain // Dedication along with this software. // If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. // Following libraries should be installed into Openscad libraries directory // eagle-pcb from https://github.com/triffid/eagle-pcb.git // MCAD from https://github.com/openscad/MCAD.git // Magpie from https://github.com/sjkelly/Magpie.git include </home/alain/.local/share/OpenSCAD/libraries/eagle-pcb/common.scad> include </home/alain/.local/share/OpenSCAD/libraries/eagle-pcb/resistor.scad> include </home/alain/.local/share/OpenSCAD/libraries/eagle-pcb/SparkFun-Connectors.scad> include </home/alain/.local/share/OpenSCAD/libraries/eagle-pcb/diode.scad> include </home/alain/.local/share/OpenSCAD/libraries/eagle-pcb/Eagle-Library.scad> // Missing colors used below blue=[0,0,1]; grey=[0.5,0.5,0.5]; // General size of the Pixl.js board board_thickness = 1.600000; board_origin = [0.000000,0.000000]; eta = 0.1; fn = 18; module downside() { rotate([180,0,0]) children(); } module transrot(tr = [0,0,0], rt = 0) { translate(tr) rotate([0,0,rt]) children(); } module C0603K(tr = [0,0,0], rt = 0) { transrot (tr,rt) downside() resistor_C0603K("C0603K", 10603); } module R0603(tr = [0,0,0], rt = 0) { transrot (tr,rt) downside() resistor_R0603("R0603", 10603); } module R1210(tr = [0,0,0], rt = 0) { transrot (tr,rt) downside() rcsmd([12 * 0.254, 10 * 0.254], "R0603", 10603); } module SOT23_5(tr = [0,0,0], rt = 0) { transrot (tr,rt) downside() Eagle_Library_SOT23_5L("SOT23_5", 23.5); } module SOD323_W(tr = [0,0,0], rt = 0) { transrot (tr,rt) downside() diode_SOD323_R("SOD323_W", 23.5); } module USB_MICROB(tr = [0,0,0], rt = 0) { transrot (tr,rt) downside() rotate([0,0,-90]) SparkFun_Connectors_USB_AB_MICRO_SMD(); } module SMT_JUMPER_3_1_NC_TRACE_NO_SILK(tr = [0,0,0], rt = 0) { // transrot (tr,rt) } module SMT_JUMPER_3_NO_NO_SILK(tr = [0,0,0], rt = 0) { // transrot(tr,rt) } module COINCELL(thickness = 3.5, diameter = 20.0) { color(silver) translate([0,0,thickness/2]) cylinder(r=diameter/2, h=thickness, center=true); } module CR2032_SMD(tr = [0,0,0], rt = 0) { transrot(tr,rt) downside() COINCELL(3.64,20); } module TACT_MEDI_RIGHT_ANGLE(tr = [0,0,0], rt = 0) { transrot(tr,rt) downside() rotate([0,0,180]) translate([0,2.45/2,3.4/2]) union() { // body color(white) cube([7.8, 2.45, 3.4], center=true); // button color(black) translate([0, (2.45/2), 0]) cube([3, 1.05, 1.5], center=true); } } module MDBT40(tr = [0,0,0], rt = 0) { transrot(tr,rt) downside() rotate([0,0,90]) translate([0,0,1.38/2]) union() { // pcb of module Dimensions: 16mm x 10mm x 2.2mm thick color(blue) cube([16.3, 10, 0.7], center=true); // ceramic antenna color(white) translate([0.8-16.3/2,0,2.15-1.38]) cube([1,8,1], center=true); // main shield of module color(silver) translate([(16.3-11.65)/2,0,2.15-1.38]) cube([11.65,8.25,1.38], center=true); } } module JHD12864_G176BSW(tr = [0,0,0], rt = 0) { transrot (tr,rt) translate([0,0,board_thickness]) union() { // pcb of module Dimensions: 16mm x 10mm x 2.2mm thick color(silver) cube([59.2,41.4,4.7], center=false); // main shield of module color(grey) translate([(59.2-55.6)/2,41.4-32.3,0.1]) cube([55.6,32.3-2.5,4.7], center=false); // viewable lcd part color(white) translate([(59.2-50)/2,41.4-25.4-5.2,0.2]) cube([50,25.4,4.7], center=false); } } module M3(tr = [0,0,0], rt = 0) { transrot(tr,rt) translate(board_origin) color(red) cylinder(r=3/2, h=board_thickness); } module PINNED_CONNECTOR(headerHeight = 9, headerWidth = 2.54,headerNbPins = 8, headerPinHeight = 11.5) { // defaults valeus are for arduino sized connectors union() { // main body color(black) cube([headerWidth, headerWidth * headerNbPins, headerHeight], center=false); // pins through PCB color(silver) for (a = [ 1 : 1 : headerNbPins ]) translate([2.54/2, a*2.54-2.54/2, headerHeight-headerPinHeight]) cylinder(d1=0.64, d2=0.64, h=headerPinHeight, center=false); } } module ARDUINO_CONNECTORS(tr = [0,0,0], rt = 0) { transrot(tr,rt) downside() union () { // 10 pins connector, translate([0, 17.526, 0]) PINNED_CONNECTOR(headerNbPins = 10); // 8 pins connector, translate([0, 44.45, 0]) PINNED_CONNECTOR(headerNbPins = 8); // 8 pins connector, translate([49.53-1.27, 26.67, 0]) PINNED_CONNECTOR(headerNbPins = 8); // 6 pins connector translate([49.53-1.27, 49.53, 0]) PINNED_CONNECTOR(headerNbPins = 6); } } module 1X02_S(tr = [0,0,0], rt = 0) { transrot (tr,rt) downside() color(white) translate([0,-1,3]) cube(6,4.5,3, center=true); } //Created by generate-scad.ulp version 0.1 module pixljs(){ board_thickness = 1.600000; eta = 0.1; board_size = [60.000000,52.500000,board_thickness]; fn = 18; board_origin = [0.000000,0.000000]; board_downside=0; //-(board_thickness); union(){ // Board without components holes color("black") difference(){ //Board translate(board_origin) cube(board_size); // Holes translate([2.400,41.750,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([2.400,39.450,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([57.600,39.450,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([57.600,41.750,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([57.600,18.050,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([57.600,20.350,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([2.400,20.350,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([2.400,18.050,-eta])cylinder(r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole translate([1.945,7.375,-eta])cylinder(r=0.750000, h=board_thickness+eta*2,$fn=fn); //hole translate([58.295,7.375,-eta])cylinder(r=0.750000, h=board_thickness+eta*2,$fn=fn); //hole translate([58.295,45.700,-eta])cylinder(r=0.750000, h=board_thickness+eta*2,$fn=fn); //hole translate([1.945,45.700,-eta])cylinder(r=0.750000, h=board_thickness+eta*2,$fn=fn); //hole translate([3.000,3.000,-eta])cylinder(r=1.600000, h=board_thickness+eta*2,$fn=fn); //hole translate([3.000,49.500,-eta])cylinder(r=1.600000, h=board_thickness+eta*2,$fn=fn); //hole translate([57.000,49.500,-eta])cylinder(r=1.600000, h=board_thickness+eta*2,$fn=fn); //hole translate([57.000,3.000,-eta])cylinder(r=1.600000, h=board_thickness+eta*2,$fn=fn); //hole translate([6.387,14.438,-eta])cylinder(r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 1 translate([8.927,14.438,-eta])cylinder(r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 2 translate([11.467,14.438,-eta])cylinder(r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 3 translate([14.007,14.438,-eta])cylinder(r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 4 translate([50.600,3.950,-eta])cylinder(r=0.400000, h=board_thickness+eta*2,$fn=fn); //H2-2.0-6X4.5MM + translate([48.600,3.950,-eta])cylinder(r=0.400000, h=board_thickness+eta*2,$fn=fn); //H2-2.0-6X4.5MM - translate([48.300,1.870,-eta])cylinder(r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X02-S 1 translate([50.840,1.870,-eta])cylinder(r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X02-S 2 translate([45.510,7.150,-eta])cylinder(r=0.400000, h=board_thickness+eta*2,$fn=fn); //JHD12864-G176BSW LEDA translate([14.720,7.150,-eta])cylinder(r=0.400000, h=board_thickness+eta*2,$fn=fn); //JHD12864-G176BSW LEDK translate([7.660,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 0 translate([10.200,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 1 translate([12.740,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 2 translate([15.280,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 3 translate([35.600,1.743,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 3.3V translate([17.820,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 4 translate([20.360,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 5 translate([33.060,1.997,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 5V translate([22.900,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 6 translate([25.440,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 7 translate([29.504,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 8 translate([32.044,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 9 translate([34.584,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 10 translate([37.124,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 11 translate([39.664,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 12 translate([42.204,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 13 translate([20.360,1.997,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A0 translate([17.820,1.743,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A1 translate([15.280,1.997,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A2 translate([12.740,1.743,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A3 translate([10.200,1.997,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A4 translate([7.660,1.743,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A5 translate([47.284,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO AREF translate([44.744,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO GND translate([27.980,1.997,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO GND. translate([30.520,1.743,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO GND.. translate([40.680,1.743,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO I/OREF translate([43.220,1.997,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO N/C translate([38.140,1.997,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO RESET translate([52.364,50.257,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO SCL translate([49.824,50.003,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO SDA translate([25.440,1.743,-eta])cylinder(r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO VIN translate([57.251,33.405,-eta])cylinder(r=0.600000, h=board_thickness+eta*2,$fn=fn); //USB-MICROB P$3 translate([57.200,26.420,-eta])cylinder(r=0.600000, h=board_thickness+eta*2,$fn=fn); //USB-MICROB P$4 } // Components added TACT_MEDI_RIGHT_ANGLE([2.400,40.600,0],90); //BTN1 TACT_MEDI_RIGHT_ANGLE([57.600,40.600,0],270); //BTN2 TACT_MEDI_RIGHT_ANGLE([57.600,19.200,0],270); //BTN3 TACT_MEDI_RIGHT_ANGLE([2.400,19.200,0],90); //BTN4 C0603K([24.400,21.800,board_downside],90); //C1 1uF 25v C0603K([27.800,22.800,board_downside],180); //C2 1uF 25v C0603K([13.800,36.300,board_downside],0); //C3 10uF 6.3v C0603K([47.000,14.400,board_downside],90); //C4 1uF 25v C0603K([19.400,26.200,board_downside],270); //CTUNE1 TBD C0603K([18.100,25.300,board_downside],270); //CTUNE2 TBD SOD323_W([50.300,17.100,board_downside],0); //D1 SOD323_W([41.200,17.200,board_downside],270); //D2 NO_FIT //translate([10.197,14.438,board_downside])1X04_S(); //DBG SOT23_5([44.200,14.500,board_downside],90); //IC2 MIC5225-3.3 //translate([49.600,3.200,board_downside])rotate([0,0,180])H2_2_0_6X4_5MM(); //J1 2p-2.0 SMT_JUMPER_3_1_NC_TRACE_NO_SILK([44.800,17.100,board_downside],180); //JP1 COINCELL_VREG SMT_JUMPER_3_NO_NO_SILK([40.920,5.540,board_downside],0); //JP2 5VSRC 1X02_S([49.570,1.870,board_downside],0); //PWR R0603([11.100,22.400,board_downside],270); //R1 100 JHD12864_G176BSW([0.620,5.750,0],0); //U$1 JHD12864 MDBT40([8.400,29.880,board_downside],90); //U$2 MDBT42Q CR2032_SMD([41.500,33.050,board_downside],90); //U$3 CR2032-SMD ARDUINO_CONNECTORS([2*35.600-0*2.54,2*26.000,board_downside],270); //U$4 ARDUINO USB_MICROB([57.200,29.900,board_downside],90); //U$5 USB-MICROB R1210([52.750,14.600,board_downside],180); //U$6 PTCFUSE M3([3.000,3.000,0],0); //U$7 M3([3.000,49.500,0],0); //U$8 M3([57.000,49.500,0],0); //U$9 M3([57.000,3.000,0],0); //U$10 } } pixljs(); //Show module
-
Hi, 1bitsy is not so far from:
Espruino wifi or Espruini pico!
They are officially supported and do get a long term support... -
Hi,
So I did get values around 192 uA - 230 uA while beeing connected, after an NRF.setLowPowerConnection(true) command , display ON and nothing beeing advertising except the Pixl's name.
The fluctuation is probably due to not averaging a long time enough.
Also, I got 50 uA with ldc off with some random reboots on other tries later.
That said it's very comparable to your figures.
So far NRF.setConnectionInterval(200) is not recognised on v1.99...So the good news is that we will have a very efficient way to save power on the next release.
-
Hi again,
Edit: some partial conclusions:
While beeing unable to measure some uA situations, I can infer from the figures below that:
a- the "normal" power consumption when no code is beeing executed and display is ON is rather like 300 - 350 uA.
b- switching off the display does save around 70 uA or 20 % from normal power consumption,
c- going to deep sleep saves may be 130 - 140 uA or 40 % from normal power consumption,
d- the Idd from the 32L476DISCOVERY is totally unappropriated to measure varying uAs as it switches from on range to another and interrupts power supply precisely at the amperages in normal power consumption mode with LCD OFF.Original post:
So my measures are as follow:Display BLE uart Measure Comment
===== ======= ======= ========ON connected 570 uA figures are fluctuating ??? BLE UART influence ?
OFF connected 500 uA figures are fluctuating ??? BLE UART influence ?
deep sleep connected 430 uA figures are fluctuating ??? BLE UART influence ? Lower than OFF
back ON connected 570 uA same as ON connected
ON not connected 220 uA jumping between 200 and 590 possibly advertising effects, peaks at 890 uA
OFF not connected 39 uA But reboots with no obvious reason!!! Self ranging ampmeter not switching correctly ????????
deep sleep not connected 37 uA But reboots with no obvious reason!!! Self ranging ampmeter not switching correctly ????????
back ON not connected ? uA Never clear displayInterestingly, reconnecting the ble uart (web ide) OR booting from an usb power bank, does stop all reboots and gives back the same behaviour and figures... So it really seems that the multi meter approach of the 32L476DISCOVERY is in default with those power variations. Unfortunately, the code of this part of the board is not open source: you can not know how measures are by the integrated coprocessor.
-
I am limited by the Idd functionnality integrated in the 32l476discovery board which is, interestingly, a kind of self ranging ampmeter limited to 50nA - 50 mA at a rather slow rate (1-3 Hz)...
It has already proven to be too averaging to be satisfying in short bursts of power and not replacing correctly an oscilloscope.About the deep sleep, I didn't cared to add the g.setRotate and g.flip(true) but it does work functionally!
My motivation was to increase the 17 days of autonomy, with a no-name coin cell, by switching off the lcd on a time of day base!
That brings me to some need about an RTC function surviving to resets and code uploads: The IDE offers the time and date automatic setup at code upload but that doesn't survive a reset() which is "illogical" as time never-ever flows back :)
-
Hi,
As a complement, I used the following code on the Pixl.js.
It allows to switch On/Off the display thus saving the few uA it consumes.
Unfortunatelly, I do not have an oscilloscope and can't measure the real reduction of power consumption, nor any short peak of power when switched on back from deep sleep.It is a very quick C++ to espruino translation and still contains unused constants... I was about to add this to the standard ST7565 module, when I understood that, indeed, the Pixl.js is using an integrated version probably in C++.
The source github repo is mentionned in the comments.
// handle lcd on/off deep sleep // extracted from // https://github.com/boseji/Rpi-ST7565-SPI-LCD/blob/master/lcdST7565.c#L729 /************************************************************************/ /* Commands */ /************************************************************************/ /* BLACK 1 WHITE 0 */ var ST7565_LCD_CMD_DISPLAY_OFF = 0xAE; var ST7565_LCD_CMD_DISPLAY_ON = 0xAF; var ST7565_LCD_PARAM_BRIGHTNESS = 0x0; /* Unused constants from github ST7565_LCD_CMD_SET_DISP_START_LINE 0x40 ST7565_LCD_CMD_SET_PAGE 0xB0 ST7565_LCD_CMD_SET_COLUMN_UPPER 0x10 ST7565_LCD_CMD_SET_COLUMN_LOWER 0x00 ST7565_LCD_CMD_SET_ADC_NORMAL 0xA0 ST7565_LCD_CMD_SET_ADC_REVERSE 0xA1 ST7565_LCD_CMD_SET_DISP_NORMAL 0xA6 ST7565_LCD_CMD_SET_DISP_REVERSE 0xA7 */ var ST7565_LCD_CMD_SET_ALLPTS_NORMAL = 0xA4; var ST7565_LCD_CMD_SET_ALLPTS_ON = 0xA5; /* Unused constants from github ST7565_LCD_CMD_SET_BIAS_9 0xA2 ST7565_LCD_CMD_SET_BIAS_7 0xA3 ST7565_LCD_CMD_RMW 0xE0 ST7565_LCD_CMD_RMW_CLEAR 0xEE */ var ST7565_LCD_CMD_INTERNAL_RESET = 0xE2; /* Unused constants from github ST7565_LCD_CMD_SET_COM_NORMAL 0xC0 ST7565_LCD_CMD_SET_COM_REVERSE 0xC8 ST7565_LCD_CMD_SET_POWER_CONTROL 0x28 ST7565_LCD_CMD_SET_RESISTOR_RATIO 0x20 */ var ST7565_LCD_CMD_SET_VOLUME_FIRST = 0x81; var ST7565_LCD_CMD_SET_VOLUME_SECOND = 0x0; var ST7565_LCD_CMD_SET_STATIC_OFF = 0xAC; var ST7565_LCD_CMD_SET_STATIC_ON = 0xAD; var ST7565_LCD_CMD_SET_STATIC_REG = 0x0; /* Unused constants from github ST7565_LCD_CMD_SET_BOOSTER_FIRST 0xF8 ST7565_LCD_CMD_SET_BOOSTER_234 0 ST7565_LCD_CMD_SET_BOOSTER_5 1 ST7565_LCD_CMD_SET_BOOSTER_6 3 ST7565_LCD_CMD_NOP 0xE3 ST7565_LCD_CMD_TEST 0xF0 */ /** * Function to control the Contrast and brightness ratio * - This is generally a fixed value for a given LCD. */ function lcd_bright ( bValue ) { retcode = 0; retcode = Pixl.lcdw(ST7565_LCD_CMD_SET_VOLUME_FIRST); if(retcode !== 0) return retcode; return Pixl.lcdw(ST7565_LCD_CMD_SET_VOLUME_SECOND | (bValue & 0x3f)); } /** * @brief Function to Put the LCD into Deep Sleep mode * */ function lcd_sleep ( ){ // * WORKS displays is wiped, so you have to g.flip() afterward Pixl.lcdw(ST7565_LCD_CMD_SET_STATIC_OFF); Pixl.lcdw(ST7565_LCD_CMD_DISPLAY_OFF); Pixl.lcdw(ST7565_LCD_CMD_SET_ALLPTS_ON); } /** * @brief Function to bring back the LCD from Deep Sleep mode * All display contents are cleared and need to reinitalize * * WARNING SO FAR DISPLAY IS SET UPSIDE DOWN */ function lcd_wakeup ( ) { Pixl.lcdw(ST7565_LCD_CMD_INTERNAL_RESET); lcd_bright(ST7565_LCD_PARAM_BRIGHTNESS); Pixl.lcdw(ST7565_LCD_CMD_SET_ALLPTS_NORMAL); Pixl.lcdw(ST7565_LCD_CMD_DISPLAY_ON); Pixl.lcdw(ST7565_LCD_CMD_SET_STATIC_ON); Pixl.lcdw(ST7565_LCD_CMD_SET_STATIC_REG | 0x03); } /** * @brief Function to Put and wakup the LCD in Standby mode * In this mode the display contents are not lost * its only not visible * @param bWakeUp Used to decide that if we need to enter or exit standby * 0 - Enters into the Standby mode * 1 - Exits the Standby mode */ function lcd_standby ( bWakeUp ) { if (bWakeUp === 0) { /* Enter standby mode */ Pixl.lcdw(ST7565_LCD_CMD_SET_STATIC_ON); Pixl.lcdw(ST7565_LCD_CMD_SET_STATIC_REG | 0x03); Pixl.lcdw(ST7565_LCD_CMD_DISPLAY_OFF); Pixl.lcdw(ST7565_LCD_CMD_SET_ALLPTS_ON); } else { /* Wake from standby */ Pixl.lcdw(ST7565_LCD_CMD_SET_ALLPTS_NORMAL); Pixl.lcdw(ST7565_LCD_CMD_DISPLAY_ON); } } var lcdstatus = 0; function lcdonoff() { lcd_standby(lcdstatus); if (lcdstatus === 0) lcdstatus = 1; else lcdstatus = 0; } setWatch(lcdonoff,BTN1,{edge:"rising", debounce:50, repeat:true});
-
-
-
Ok, I reflashed with the new cable and it seems to work now...
Sorry for the disturbance!So I closed the discussion and can't add more posts....
Things are tricking:
Turning off minimification and offline mode imposed me to disconnect and reconnect the board in order to have success. Otherwise, the errors went back as described above.Then, setting back offline mode does impose the same disconnection/reconnection once only and the problem seems not to reappear: Non errors nor warnings and correct result of 21.
Then turning minimification back to Espruima offline on, did imposed also disconecting/reconnecting once only the board.
Then turning minimification back to Closure online (whitespace only) on, did imposed also disconecting/reconnecting once only the board.
So it could be a problem of stored configuration in the web ide finaly???
-
You are very reactive and some of our posts got unsynced.
Thank you for that.
Anyway, everythings is shown above.
I don't think it is related to the webide itself, or at least not the last version.
It seems, just an opinion, to be related to serial buffering as I mentionned some cases, which did not appeared here, showed some strings not displayed on the left pane of the webide until I pressed the Enter key. -
Now disconnected and uploaded again:
Disconnected Connected > > _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95 Copyright 2017 G.Williams >21 =undefined >
And full log after first fail and second success:
Initialising Terminal Initialising CodeWriter Initialising Modules Initialising Env Initialising Flasher Initialising EditorBlockly Initialising EditorJavaScript Initialising Send Initialising MenuPortSelector Initialising MenuSettings Initialising MenuFlasher Initialising SettingsAbout Initialising SettingsFlasher Initialising BoardJSON Initialising VersionChecker Initialising Compiler Initialising Assembler Initialising GetGitHub Initialising SetTime Initialising Unicode Initialising Minify Initialising SaveOnSend Initialising Tutorial Initialising Webcam Initialising FontSize Initialising UiMode Initialising URLHandler Initialising CodeLink Initialising Project Initialising Testing Initialising Notification_Sound Initialising Tern Initialising Debugger Initialising Tour Initialising SettingsProfile Initialising HelpLinks Initialising Offline Loaded code from storage. GET chrome.storage.local.OFFLINE_DATA = 497080 bytes No navigator.bluetooth - Web Bluetooth not enabled >>> Connecting... ForceThrottle option is set - set Slow Write = true [object Object] Connected [object Object] Found a prompt... great! >>> Sending... ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n" >>> Sent Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n" Loading http://www.espruino.com/json/ESPRUINOBOARD.json Searching for json/ESPRUINOBOARD.json json/ESPRUINOBOARD.json found in offline archive Board JSON loaded Firmware >1.43 supports faster writes over USB ForceThrottle option is set - set Slow Write = true FIRMWARE: Current 1v95, Available 1v95 Device found (connectionId=1) [success] Connected to port /dev/ttyACM0 >>> Connected to port /dev/ttyACM0 ERROR: [notify_error] Compiler not active as no process.env.EXPORTS/EXPTR available.<br/>Is your board supported and firmware up to date? WARNING: [notify_warn] Errors while minifying - sending unminified code. Found a prompt... great! >>> Sending... ---> "\u0010reset();\n\u0010setTime(1518688740.932);\n\u0010var c = E.compiledC(`\n // int sum(int, int)\n int sum(int len, unsigned char *data){\n int s = 0;\n while (len--)\n s += *(data++);\n return s;\n }\n `);\n\u0010var str = E.toString(\"\\1\\2\\3\\4\\5\\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n" Splitting at "reset();\n", delay 250 ERROR: [notify_error] Input_0:11: ERROR - This style of octal literal is not supported in strict mode. ERROR: [notify_error] var str = E.toString("\1\2\3\4\5\6"); // create a flat string ERROR: [notify_error] ^ >>> Sent Disconnect callback... WARNING: [notify_warn] Disconnected >>> Disconnected >>> Connecting... ForceThrottle option is set - set Slow Write = true [object Object] Connected [object Object] Found a prompt... great! >>> Sending... ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n" >>> Sent Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n" Loading http://www.espruino.com/json/ESPRUINOBOARD.json Searching for json/ESPRUINOBOARD.json json/ESPRUINOBOARD.json found in offline archive Board JSON loaded Firmware >1.43 supports faster writes over USB ForceThrottle option is set - set Slow Write = true FIRMWARE: Current 1v95, Available 1v95 Device found (connectionId=2) [success] Connected to port /dev/ttyACM0 >>> Connected to port /dev/ttyACM0 WARNING: [notify_warn] Errors while minifying - sending unminified code. Found a prompt... great! >>> Sending... ---> "\u0010reset();\n\u0010setTime(1518688966.433);\n\u0010var c = (function(){\u001b\n var bin=atob(\"ChgAIJFCA9AR+AE7GET553BHAAA=\");\u001b\n return {\u001b\n sum:E.nativeCall(1, \"int(int, int)\", bin),\u001b\n };\u001b\n})();\n\u0010var str = E.toString(\"\\1\\2\\3\\4\\5\\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n" Splitting at "reset();\n", delay 250 ERROR: [notify_error] Input_0:8: ERROR - This style of octal literal is not supported in strict mode. ERROR: [notify_error] var str = E.toString("\1\2\3\4\5\6"); // create a flat string ERROR: [notify_error] ^ >>> Sent
Hi,
Not really, but quite close to that... In fact it was a class and I did not found a way to list the source of a class. My trick gets the source of an instance of a class.
All of this happened on an instance of the class runningStats which was itself a property or an instance of the class object stopWatch.
Indeed I deleted the source code in the editor (right side pane) and stupidly saved that incomplete source code to my PC without noticing what had disappeared. Could we get versionning every time we save a source, maybe just renaming the previous same named file with an added time stamp automatically?
The joined file contains that whole thing in terms of: what the little trick gave from the running source on the Espruino, what I finally got after re-editing this dump to get a new version of the source.
Thus I was left with a running instance of my program on the Pico and no way to list it to get back the almost last version of it.
That said, I think it would be nice to be able to reconstruct an object by just a simple dump.
Eventually, some improvements on the editor side would be nice too: something like "Do you want to delete the lines selected" when there are many of them.