Skip to content

Latest commit

 

History

History
72 lines (55 loc) · 2.13 KB

File metadata and controls

72 lines (55 loc) · 2.13 KB

Development Guide

Testing the Extension

Method 1: Load from File (Easiest)

  1. Open TurboWarp
  2. Click the extension button (+) at the bottom left
  3. Scroll down and click "Custom Extension"
  4. Click "Choose Extension File"
  5. Select line-us-extension.js

Method 2: Local HTTP Server (For Development)

If you're making changes and want faster iteration:

  1. Start a local server in this directory:

    # Python 3
    python3 -m http.server 8080
    
    # Python 2
    python -m SimpleHTTPServer 8080
    
    # Node.js (if you have http-server installed)
    npx http-server -p 8080
  2. In TurboWarp's custom extension dialog, enter:

    http://localhost:8080/line-us-extension.js
    

Method 3: Copy/Paste Code

  1. Copy the contents of line-us-extension.js
  2. In TurboWarp's custom extension dialog, click "Paste Extension Code"
  3. Paste the code

Key Changes from ScratchX Version

  1. Extension Structure: Converted from function wrapper to ES6 class
  2. Block Definitions: Updated to Scratch 3.0 getInfo() format
  3. Async Handling: All functions now return Promises instead of using callbacks
  4. Menu System: Updated to new menu format
  5. Color Scheme: Added extension colors

Testing Checklist

  • Extension loads without errors
  • All blocks appear in the block palette
  • Connection block works (test with Line-us robot if available)
  • Movement commands function properly
  • Pen up/down commands work
  • Speed settings apply correctly
  • G-code sending works
  • Disconnection works properly

Known Limitations

  • Projects using this extension cannot be uploaded to scratch.mit.edu
  • Requires TurboWarp's unsandboxed extension environment
  • WebSocket connections require Line-us robot on same network

Troubleshooting

Extension won't load:

  • Check browser console for JavaScript errors
  • Ensure you're using TurboWarp, not regular Scratch
  • Make sure file path is correct if using local server

Can't connect to Line-us:

  • Verify Line-us is on same network
  • Check Line-us hostname/IP address
  • Ensure Line-us firmware supports WebSocket connections