Skip to content
jtLabHIUPublic

About

jtLab Scratch 3 Helper app

Resources

Stars

0 stars

Watchers

2 watching

Forks

Latest commit

 

History

78 Commits

Folders and files

Repository files navigation

jtS3Helper

jtLab Scratch 3 Helper app

  • work on Electron
  • run in task tray
  • communicate with Scratch 3 through WebSocket

branches:

  • Latest release and current development branch: dev_3.0
  • Previous release branch: dev191017
  • Current upstream version: 3.18.1 (2020/12/06)

Build for Windows

The current build uses an existing Windows scratch-desktop production build and does not rebuild or modify scratch-editor or scratch-desktop. Place s3h and scratch-desktop as siblings on a Windows-accessible filesystem. From the jtScratch addon, run jtScratch build first to create scratch-desktop/dist/win-unpacked.

In a Windows shell with Node.js and npm available, and WSL or Git Bash's bash available in PATH, run the following in the s3h directory:

npm install --foreground-scripts
npm run dist

The first command downloads and installs dependencies and changes node_modules and possibly package-lock.json. Do not reuse Linux node_modules for Windows. The second command creates jtS3H-win32-x64 containing jtS3H, its assets, and a copy of the existing Desktop build. It refuses to overwrite an existing output directory, including one left by a failed build; inspect and remove or move it yourself before retrying. It does not publish an installer.

Run jtS3H-win32-x64\jtS3H.exe to launch Scratch and jtS3H. The package uses the default Electron executable icon. Bluetooth and micro:bit BLE are disabled in this build: their source remains, but @abandonware/noble is not installed. The legacy Electron and other dependencies have known security vulnerabilities; the build is not yet validated for a safe public release.

How to run

  • git clone https://github.com/jtLabHIU/s3h.git
  • cd s3h
  • npm install --foreground-scripts using Windows npm
  • modify /node_modules/wifi-control/lib/win32.js (see below)
  • npm start(invoke Scratch that compiled static) or npm run devserv(use Scratch that running on webpack-dev-server)

see also readme_scratch.md

modify wifi-control module

  • add chcp 437 & into before netsh of line 69 & 163

webpack proxy

  • add proxy entry into line 24 of webpack.config.js on scratch-gui
        proxy: {
            'jtS3H': {
                target: 'http://localhost:5963'
            }
        }

further information

my Memo

  • Tello vs Tello Edu

    • sdk?
      • unknown command: sdk? / 20
  • chcp

    • 932 - Japanese Shift-JIS
    • 437 - English
    • 65001 - UTF-8
  • arp -a

Interface: 192.168.10.2 --- 0x6
  Internet Address      Physical Address      Type
  192.168.10.1          60-60-1f-d2-d5-55     dynamic
  192.168.10.255        ff-ff-ff-ff-ff-ff     static

インターフェイス: 10.70.78.153 --- 0x5
  インターネット アドレス 物理アドレス           種類
  10.70.78.254          50-3d-e5-a0-0d-ff     動的
  10.70.78.255          ff-ff-ff-ff-ff-ff     静的
  • ping -n 1 -w 4 192.168.10.1~254
Pinging 192.168.10.1 with 32 bytes of data:
Request timed out.

Ping statistics for 192.168.10.1:
    Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),

Pinging 192.168.10.1 with 32 bytes of data:
Reply from 192.168.10.1: bytes=32 time=1ms TTL=255

Ping statistics for 192.168.10.1:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms


192.168.10.1 に ping を送信しています 32 バイトのデータ:
192.168.10.1 からの応答: バイト数 =32 時間 =1ms TTL=255

192.168.10.1 の ping 統計:
    パケット数: 送信 = 1、受信 = 1、損失 = 0 (0% の損失)、
ラウンド トリップの概算時間 (ミリ秒):
    最小 = 1ms、最大 = 1ms、平均 = 1ms

192.168.10.1 に ping を送信しています 32 バイトのデータ:
要求がタイムアウトしました。

192.168.10.1 の ping 統計:
    パケット数: 送信 = 1、受信 = 0、損失 = 1 (100% の損失)、
  • ap command send: ap ETROBO etrobocon_hkd Response: OK,drone will reboot in 3s Received 26 bytes from 192.168.10.1:8889

  • multi tello

    • connect WiFi direct with the target Tello
    • send ap SSID PASSWORD command to tello
      • restart automatically as STA mode
    • ping to tello and mome IP and MAC pair
      • we can connect automatically that lookup with ARP command
    • sockCommand must listening different UDP port
    • all tello response to localhost:8889UDP only
      • these can recognize by IP address that tellos send
  • todo limit 1 hop scratch 1/2 helper compatible

  • devSock

    • Tello can't reconnect to another UDP port, such make it by 0
  • AP list auto-update on Windows

  • jtMesh

    • Mesh is based upon remote sensor connections through port 42001
    • scratch-vm/src/engine/variables.js
    • packet: <size: 4 bytes><msg: size bytes>
    • Most message types contain human-readable strings made up of the following elements:
      • Unquoted single-word strings (cat, mouse-x)
      • Quoted strings ("a four word string", "embedded ""quotation marks"" are doubled")
      • Numbers (1, -1, 3.14, -1.2, .1, -.2)
      • Booleans (true or false)
      • Words and strings are encoded in UTF-8.
    • sensor-update "note" 60 "seconds" 0.1
    • broadcast "play note"
    • Scratch 2.0 Extension Protcol
  • Scratch3 /broadcast

    • broadcast(args, util) and broadcastAndWait(args, util) are defined in scratch-vm/src/blocks/scratch3_event.js
      • args:object
        • BROADCAST_OPTION
          • id: uid
          • name: message
      • util:BlockUtility (engine/block-utility.js)
        • sequencer:Sequencer
        • thread:Thread
        • proto
          • target: this.thread.target: Target (engine/target.js)
          • startHats('event_whenbroadcastreceived', {BROADCAST_OPTION: broadcastOption});
            • calls sequencer.runtime.startHats (engine/runtime.js)
  • Scratch3 /sensorupdate

    • variable blocks are defined in scratch-vm/src/blocks/scratch3_data.js

road to opencv

for windows:

  • download cmake-3.16.0-rc4-win64-x64.zip or latest one from CMake website
  • deflate into $Pzenbu\cmake
  • open an administrative Powershell when you want to use node-gyp on Windows
  • Set-Item Env:Pzenbu "path\to\$Pzenbu"
  • Set-Item Env:PATH "$Env:Pzenbu\node.js;$Env:Pzenbu\cmake\bin;$Env:PATH"
  • cd path\to\your\workspace
  • npm install -g windows-build-tools
    • try npm config get python to check

for mac

  • download cmake-3.16.0-rc4-Darwin-x86_64.dmg or latest one from CMake website
  • execute this file to mount as installer
  • select agree button
  • drag-and-drop CMake icon into $Pzenbu
  • open the Terminal
  • Pzenbu="path/to/$Pzenbu"
  • PATH="$Pzenbu/CMake.app/Contents/bin:$PATH"

for common

  • npm install -g node-gyp
  • add entry into package.json
  ,
  "opencv4nodejs": {
    "autoBuildOpencvVersion": "4.1.1"
  }
  • npm install --save opencv4nodejs

  • git clone https://github.com/justadudewhohacks/opencv4nodejs.git

  • ToDo: electorn-rebuild

    • cd ..
    • git clone https://github.com/justadudewhohacks/opencv-electron.git
    • cd opencv-electron/plain-js
    • npm install

.\ffmpeg -i udp://0.0.0.0:11111 -f sdl "tello"

About

jtLab Scratch 3 Helper app

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages