Avatar for NoobJS

NoobJS

Member since Jul 2021 • Last active Oct 2021
  • 1 conversations
  • 8 comments

Most recent activity

    • 15 comments
    • 1,788 views
  • in Projects
    Avatar for NoobJS

    Oh-ho-ho-ho, assembler is no longer easy. But maybe I'll try to figure it out later. I decided to remove the rev display completely, so as not to interfere with the speedometer display. The tachometer will be a scale made of LEDs anyway.
    I decided to build a driver to control the tachometer, it will use dynamic indication.

  • in Projects
    Avatar for NoobJS

    Unfortunately, my experience is not enough to create the firmware. I know programming superficially, and haven't worked with electronics much, I spent most of my working life repairing cars =).
    I found a manual in my native language, detailing what commands are needed to work with the display. And I think I understood why it's impossible to make a nice smooth font. What I don't understand is the speed of the SPI port on my controller.The maximum interface speed should be up to 20megabit, but I guess it all comes down to the speed of the controller port.
    Of course I can buy another display and another controller in general e.g. raspberry and connect the display to another level. But we are not looking for easy ways =). You can ride with the dashboard you have on the bike now. But I like to invent something. So I hope to see it through to the end.

  • in Projects
    Avatar for NoobJS

    Since you deal you can also use fixed fonts rather than vector fonts and scale them... it is a bit jagged then, but it is much faster. Drawing and filling is the challenge.

    The question is why drawing a line is much slower than drawing a rectangle.
    https://youtu.be/aYKweXBdzTc

      g.drawLine(0, 110, 320, 110);
      g.setColor(0,1,0);
      g.drawRect(0,130,320,130);
      g.setColor(1,0,0);
      g.drawLine(150, 0, 150, 240);
      g.setColor(0,0,1);
      g.drawRect(170, 0, 170, 240);
    

    Is it possible to make a fast font of fixed size?

  • in Projects
    Avatar for NoobJS

    You haven't clearly formulated your task.
    -Do you need a device with an epaper display for reading a pdf? There is one.
    -If you need to read roadmaps, specify what file format they use.

  • in Projects
    Avatar for NoobJS

    The readings will be outlined differently than in the video because the bike reaches 100km/h in less than 4 seconds. The speed sensor is a magnet attached to the wheel and an electromagnetic sensor that is triggered when the magnet passes near it. Readings will come in 0, ~22,~44,~57..... It might be worth creating another variable to store the time it takes to render one character or the whole number. Then as soon as a reading is shown on the display, the next reading from the sensor will be read and shown immediately.
    And here is the question, whether using :

    setWatch(callback, pin [, opts])
    

    Will this method be able to trigger the tachometer frequency (14000 rpm)?

  • in Projects
    Avatar for NoobJS

    I tried changing the orientation of the display. I didn't notice any increase in rendering speed. The Vector font still draws very slowly.

  • in Projects
    Avatar for NoobJS

    Thank you so much for the advice. It's good to have a lively community.
    I have not yet figured out how to work with the buffer, and in general, I have huge problems understanding how binary code should work.
    For starters I just changed the font .as I was advised. The rendering speeded up many times over, but the numbers were less beautiful. So I made those readings that change very fast in one font, and those that change slowly in a pretty font.

    Readings of gear and acceleration (0-100km/h) will be calculated on the basis of speed and engine speed, because I do not want to install a sensor for gear selection.
    For clarity, I screwed setTimeout to the speedometer, so it was clear at what speed the readings change. In fact, the data on the speedometer meter will be different (not in increments of 1km/h).
    Not to run to the bike, I think to build an emulator for speedometer and tachometer.
    I will be glad to hear suggestions on code optimization. Is it possible to make "Vector" font to be displayed with the same speed.
    If you choose the color outside the body of the class, the code works, but if the method of the class (line 10 of code), then for some reason the color does not change

    https://youtu.be/O3ZKkRJ4A4Q

    A3.set(); // light on
     require("Font7x11Numeric7Seg").add(Graph­ics);
    
    SPI1.setup({sck:A5, miso:P2, mosi:P3, baud:10000000000000000});
    
    var g = require("ILI9341").connect(SPI1, A2, A0, A1, function() {
      g.clear();
      g.setRotation(1);
    
      g.drawLine(5, 171, 315, 172);
      g.drawLine(5, 75, 235, 75);
      g.drawLine(70, 36, 235, 36);
      g.drawLine(160, 175, 160, 235);
      g.drawRect(240, 0, 320, 140);
      g.drawRect(0, 0, 65, 71);
      g.fillRect(240, 123, 320, 143);
      g.fillRect(0, 60, 65, 71);
      g.fillRect(120, 175, 160, 195);
      g.fillRect(160, 215, 200, 235);
      g.fillRect(193, 15, 235, 35);
      g.fillRect(70, 36, 120, 56);
      g.setFontVector(21);
    
      g.setColor('#000000');
      g.setFontVector(19);
      g.drawString("GEAR",257,125);
      g.setFontVector(13);
      g.drawString("0-100",15,60);
      g.setFontVector(21);
      g.drawString("km",126,175);
      g.setFontVector(21);
      g.drawString("odo",165,215);
      g.setFontVector(21);
      g.drawString("rpm",195,14);
      g.setFontVector(21);
      g.drawString("temp",71,37);
    
      g.setColor('#ffffff');
      g.setFontVector(21);
      g.drawString("km/h",215,149);
      g.setFontVector(39);
      g.drawString("C",198,40);
    });
    setTimeout(()=>{
    
    let parameters ={
    speedometer:{
    x:140,
    y: 80,
    font:{name:"7x11Numeric7Seg",size:8,high­t:88,color:'#ffffff'}
    },
    tachometer:{
    x:170,
    y:1,
    font:{name:"7x11Numeric7Seg",size:3,high­t:33,color:'#ffffff'}
    },
    gear:{
    x:250,
    y:5,
    font:{name:"Vector",size:130,hight:60,co­lor:'#00ff00'}
    },
    temperature:{
    x:170,
    y:40,
    font:{name:"Vector",size:39,hight:24,col­or:'#ffffff'}
    },
    odometer:{
    x:295,
    y:176,
    font:{name:"Vector",size:40,hight:20,col­or:'#ffffff'}
    },
    run:{
    x:100,
    y:200,
    font:{name:"Vector",size:40,hight:20,col­or:'#ffffff'}
    },
    acceleration:{
    x:25,
    y:20,
    font:{name:"Vector",size:30,hight:20,col­or:'#ffffff'}
    }
    };
    
      class Counter {
    constructor(value) {
    this.value = value;
    }
    
     countSym(number,param) {
    number = number.toString();
    let oneSym = {
    value: number.split("").reverse(),
    posX:  param.x,
    posY:  param.y,
    font:  param.font
    };
    this.value = oneSym;
    }
    
     renderNum (numForRender) {
       g.setColor(this.value.font.color);
       g.setFont(this.value.font.name,this.valu­e.font.size);
    let number = numForRender.toString().split("").revers­e();
    let step = g.stringWidth(number[0]);
    
    for(let i = 0; i<number.length; i++){
    if(number[i]!==this.value.value[i]){
      if(i===0){
    
      g.clearRect(this.value.posX,this.value.p­osY,this.value.posX + step,this.value.posY + this.value.font.hight);
      g.setColor(1,1,1);
    
      g.drawString(number[i], this.value.posX, this.value.posY);
    }else{
    
    g.clearRect(this.value.posX - i*step,this.value.posY,this.value.posX - (i===1?0:(i-1)*step),this.value.posY + this.value.font.hight);
      g.drawString(number[i], this.value.posX-step*i, this.value.posY);
    }
      }
    }
      this.value.value = number;
    }
    }
    
    let speedometer = new Counter(0);
    speedometer.countSym(1,parameters.speedo­meter);
    speedometer.renderNum(0);
    
    let tachometer = new Counter(0);
    tachometer.countSym(1,parameters.tachome­ter);
    tachometer.renderNum(12000);
    
    let gear = new Counter(0);
    gear.countSym(1,parameters.gear);
    gear.renderNum(6);
    
    let temperature = new Counter(0);
    temperature.countSym(1,parameters.temper­ature);
    temperature.renderNum(98);
    
    let odometer = new Counter(0);
    odometer.countSym(1,parameters.odometer)­;
    odometer.renderNum(1140);
    
    let run = new Counter(0);
    run.countSym(1,parameters.run);
    run.renderNum(42657);
    
    let acceleration = new Counter(0);
    acceleration.countSym(1,parameters.accel­eration);
    acceleration.renderNum(3);
      
    for(let i = 0; i<=200; i++){
    speedometer.renderNum(i);
    
    }
    
    }, 500);
    
  • in Projects
    Avatar for NoobJS

    Hi all.
    This is my first post on your forum. Please excuse my poor English, because it is not my native language.
    I decided to make a dashboard for my '98 Honda cb600 motorcycle. I chose IskraJS module because I have experience in writing code in java script.
    I want to make a tachometer from 50 two color LEDs connected through a bunch of unl2803+74hc595. And the display will show: speed, engine temperature, mileage, selected transmission...
    While I figured out how to connect it all, but ran into a problem, too slow rendering images on the screen. If you can put up with the initial rendering, then on the road I would like to draw the numbers faster. Позже добавлю видео работы и код, а пока только фото

Actions