jalibu / MMM-Jast

A minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform.
MIT License
67 stars 22 forks source link

Scroll speed insanely fast #51

Closed bhoglan closed 1 year ago

bhoglan commented 1 year ago

Platform

Raspbian GNU/Linux 11 (bullseye)

Node.js Version

v14.21.1

MagicMirror Version

2.21.0

Module Version

v2.8.0 - 1cc458dbcb0ddbc41e5bc1ba6117b305bc15a8fd

Description

I'm trying to use the module in horizontal mode. At the default fadeSpeedInSeconds of 3.5 the text just zips across the screen in an unreadable blur. I was finally able to get it to a readable speed at a value of 10000 but by that point it spends so much time "between scrolls" that it might as well not be in the config at all. Additionally its presence makes the news ticker on the bottom bar really jitterry on scrolling.

            // { // Commented because the scrolling is causing issues with the bottom scroller
            //      module: "MMM-Jast", //https://github.com/jalibu/MMM-Jast
            //      position: "top_bar",
            //      config: {
            //              currencyStyle: "symbol", // One of ["code", "symbol", "name"]
            //              fadeSpeedInSeconds: 10000,
            //              lastUpdateFormat: "HH:mm",
            //              maxChangeAge: 1 * 24 * 60 * 60 * 1000,
            //              maxWidth: "100%",
            //              numberDecimalsPercentages: 1,
            //              numberDecimalsValues: 2,
            //              scroll: "none", // One of ["none", "vertical", "horizontal"]
            //              showColors: true,
            //              showCurrency: true,
            //              showChangePercent: true,
            //              showChangeValue: true,
            //              showChangeValueCurrency: false,
            //              showHiddenStocks: false,
            //              showLastUpdate: false,
            //              showPortfolioValue: true,
            //              showPortfolioGrowthPercent: false,
            //              showPortfolioGrowth: true,
            //              updateIntervalInSeconds: 300,
            //              useGrouping: true,
            //              virtualHorizontalMultiplier: 2,
            //              stocks: [
            //                      { name: "Clearwater Analytics", symbol: "CWAN", quantity: xxxx },
            //                      { name: "Costco", symbol: "COST", quantity: 0 },
            //                      { name: "Oracle", symbol: "ORCL", quantity: 0 },
            //                      { name: "Google", symbol: "GOOG", quantity: 0}
            //              ]
            //      }
            // },

Expected behavior

The scrolling should be at a reasonable rate so as to be visible the majority of the time while also being readable when on screen. Additionally it shouldn't be causing other modules to have issues. I understand the Pi's processor is somewhat limited, but this doesn't feel right.

Current behavior

At default speed the text is unreadable as it flashes across the screen. At a speed of 10000 the top bar is usually empty but the text is actually readable when it does appear. The bottom news ticker (MMM-Reddit-News-Ticker) is jittery when scrolling.

Possible solution

I think a workable solution would be a static scroll mode similar to 'none' but in a horizontal orientation. I'd branch it myself but I just plain don't know js or node.

Steps to reproduce

  1. Add the config I pasted in description to the MagicMirror/config/config.jsfile (uncommented, of course).
  2. Start mm, in my case I'm use pm2 so I use either pm2 start mm or pm2 restart mm.
  3. Let the config parse and load. Observe the fast speed or slow speed, depending on the value of fadeSpeedInSeconds.
  4. Observe the jittery behavior of the bottom ticker.

Log

Hardware: Raspberry Pi 3B
Modules running: (in this order)
- clock - top_left
- calendar - top_left (2 calendars running, minimal events showing (1 currently))
- MMM-XKCD - top_left
- MMM-CyberSecurity-News - bottom_left (2 articles) (feed changed to another rss feed though)
- weather - top_right - type: current
- MMM-AQI - top_right
- weather - bottom_right - type: forecast
- MMM-Jast - top_bar
- MMM-Reddit-News-Ticker - bottom_bar
With mm running with all the above modules, pm2 reports 0% CPU usage and 2.8mb memory usage.
 22:45:07 up 19 days,  3:47,  4 users,  load average: 1.86, 2.00, 2.07

config.js

/* MagicMirror² Config Sample
 *
 * By Michael Teeuw https://michaelteeuw.nl
 * MIT Licensed.
 *
 * For more information on how you can configure this file
 * see https://docs.magicmirror.builders/configuration/introduction.html
 * and https://docs.magicmirror.builders/modules/configuration.html
 */
let config = {
    address: "0.0.0.0",     // Address to listen on, can be:
                            // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
                            // - another specific IPv4/6 to listen on a specific interface
                            // - "0.0.0.0", "::" to listen on any interface
                            // Default, when address config is left out or empty, is "localhost"
    port: 8080,
    basePath: "/",  // The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
                    // you must set the sub path here. basePath must end with a /
    ipWhitelist: ["127.0.0.1", "192.168.10.0/24", "::ffff:127.0.0.1", "::1"],   // Set [] to allow all IP addresses
                                                            // or add a specific IPv4 of 192.168.1.5 :
                                                            // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
                                                            // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
                                                            // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

    useHttps: false,        // Support HTTPS or not, default "false" will use HTTP
    httpsPrivateKey: "",    // HTTPS private key path, only require when useHttps is true
    httpsCertificate: "",   // HTTPS Certificate path, only require when useHttps is true

    language: "en",
    locale: "en-US",
    logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
    timeFormat: 24,
    units: "imperial",
    // serverOnly:  true/false/"local" ,
    // local for armv6l processors, default
    //   starts serveronly and then starts chrome browser
    // false, default for all NON-armv6l devices
    // true, force serveronly mode, because you want to.. no UI on this device

    modules: [
        {
            module: "alert",
        },
    //  {
    //      module: "updatenotification",
    //      position: "top_bar"
    //  },
        {
            module: "clock",
            position: "top_left",
            clockBold: "true",
            showSunTimes: "true"
        },
        {
            module: "calendar",
            header: "Brian's Calendar",
            position: "top_left",
            config: {
                fade: "false",
                fadePoint: "1",
                maximumNumberOfDays: "7",
                calendars: [
                    {
                        symbol: "calendar-check",
                        color: "FF0000",
                        url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
                    },
                    {
                        symbol: "cat",
                        url: "<REDACTED>"
                    }
                ]
            }
        },
        {
            module: "MMM-XKCD", //https://github.com/jupadin/MMM-XKCD
            position: "top_left",
            config: {
                header: "xkcd",
                updateInterval: 10 * 60 * 60 * 1000,
                grayScale: false,
                invertColors: false,
                limitComicWidth: 400,
                limitComicHeight: 0,
                randomComic: true,
                alwaysRandom: false,
                showTitle: true,
            }
        },
        {
            module: "MMM-CyberSecurityNews",
            position: "bottom_left",
            header: "https://www.darkreading.com",
            config: {
                numberOfArticles: 2
            }
        },
        {
            module: "weather",
            position: "top_right",
            config: {
                weatherProvider: "openweathermap",
                type: "current",
                units: "imperial",
                timeFormat: "24",
                locationID: "<REDACTED>",
                apiKey: "<REDACTED>"
            }
        },
        {
            module: "MMM-AQI",
            position: "top_right",
            header: 'Air Quality Index (AQI)',
            config: {
                token: "<REDACTED>",
                city: "<REDACTED>", 
                iaqi: true,
                updateInterval: 30 * 60 * 1000, // 30 minutes
                initialLoadDelay: 0,
                animationSpeed: 1000,
                debug: false
            }
        },
        {
            module: "weather",
            position: "bottom_right",
            config: {
                weatherProvider: "openweathermap",
                type: "forecast",
                colored: "true",
                weatherEndpoint: "/forecast",
                locationID: "<REDACTED>",
                apiKey: "<REDACTED>",
                fade: "false",
                fadePoint: "1"
            }
        },
        { // Commented because the scrolling is causing issues with the bottom scroller
            module: "MMM-Jast", //https://github.com/jalibu/MMM-Jast
            position: "top_bar",
            config: {
                currencyStyle: "symbol", // One of ["code", "symbol", "name"]
                fadeSpeedInSeconds: 10000,
                lastUpdateFormat: "HH:mm",
                maxChangeAge: 1 * 24 * 60 * 60 * 1000,
                maxWidth: "100%",
                numberDecimalsPercentages: 1,
                numberDecimalsValues: 2,
                scroll: "vertical", // One of ["none", "vertical", "horizontal"]
                showColors: true,
                showCurrency: true,
                showChangePercent: true,
                showChangeValue: true,
                showChangeValueCurrency: false,
                showHiddenStocks: false,
                showLastUpdate: false,
                showPortfolioValue: true,
                showPortfolioGrowthPercent: false,
                showPortfolioGrowth: true,
                updateIntervalInSeconds: 300,
                useGrouping: true,
                virtualHorizontalMultiplier: 2,
                stocks: [
                    { name: "Clearwater Analytics", symbol: "CWAN", quantity: xxxx },
                    { name: "Costco", symbol: "COST", quantity: 0 },
                    { name: "Oracle", symbol: "ORCL", quantity: 0 },
                    { name: "Google", symbol: "GOOG", quantity: 0}
                ]
            }
        },
        {
            module: "MMM-Reddit-News-Ticker",
            position: "bottom_bar",
            config: {
                client_id: "<REDACTED>",
                secret: "<REDACTED>"
            }
        }
    ]
};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

Additional info

No response

jalibu commented 1 year ago

Hi @bhoglan,

does this problem also occur if you disable other modules? Hundreds of other users use this module without problems, so I guess it is caused by an interference with another of your modules

bhoglan commented 1 year ago

Hi @jalibu thanks for the response. I don't doubt that others are using this module successfully. I think the bottom news ticker being jittery is unrelated to this module. I think it's something with that module specifically. As for the Jast module, I changed the scroll to "none" and just have the listings static. It takes up less room at the top of my screen than I expected, so I'm ok with this workaround.