https://toitlang.org/ logo
Join Discord
Powered by
# general
  • b

    bmentink

    04/29/2025, 8:25 AM
    ok, thanks
  • f

    floitsch

    04/29/2025, 8:29 AM
    Maybe
    toit compile --snapshot -o foo.snapshot foo.toit
    followed by
    toit tools snapshot-to-image -o foo.img foo.snapshot -m32 --format=binary
    gives the size. Not 100% sure.
  • k

    kasperl

    04/29/2025, 8:37 AM
    If it's the size of the entire pod, it should be easy?
  • f

    floitsch

    04/29/2025, 8:38 AM
    Right. I misread it, and thought we were talking about individual containers.
  • k

    kasperl

    04/29/2025, 8:39 AM
    I think the first step is to get to the envelope from the pod.
  • f

    floitsch

    04/29/2025, 8:40 AM
    Yes. Once we have the envelope, it should be enough to
    toit tool firmware --envelope=... extract --out=...
  • k

    kasperl

    04/29/2025, 8:41 AM
    You can also extra the firmware binary from the pod for a specific device using
    artemis
    .
  • f

    floitsch

    04/29/2025, 8:41 AM
    That's probably easier.
  • f

    floitsch

    04/29/2025, 8:42 AM
    artemis device extract -h
    has some examples.
  • f

    floitsch

    04/30/2025, 5:02 PM
    Just got the first version of RMT encoder support working. (Not reviewed, and might change) For example, the following emits a valid UART signal using the RMT. The encoder maps the patterns to RMT signals inside an interrupt (in C). @thomas6886: something like this might work for the DMX controller.
    Copy code
    out-channel := rmt.Out pin --resolution=RESOLUTION
    
      uart-period := RESOLUTION / BAUD-RATE
    
      uart-start := rmt.Signals 2
      uart-start.set 0 --level=0 --period=uart-period - 1
      uart-start.set 1 --level=0 --period=1
    
      // A combination of the stop and start signals.
      uart-between := rmt.Signals 2
      uart-between.set 0 --level=1 --period=uart-period  // A stop bit.
      uart-between.set 1 --level=0 --period=uart-period  // A start bit.
    
      uart-stop := rmt.Signals 2
      uart-stop.set 0 --level=1 --period=uart-period - 1
      uart-stop.set 1 --level=1 --period=1
    
      // We use chunks of 2 bits, so that we don't waste signal memory.
      // rmt.Signals of length 1 are padded to size 2.
      uart-00 := rmt.Signals 2
      uart-00.set 0 --level=0 --period=uart-period
      uart-00.set 1 --level=0 --period=uart-period
      uart-01 := rmt.Signals 2
      uart-01.set 0 --level=1 --period=uart-period
      uart-01.set 1 --level=0 --period=uart-period
      uart-10 := rmt.Signals 2
      uart-10.set 0 --level=0 --period=uart-period
      uart-10.set 1 --level=1 --period=uart-period
      uart-11 := rmt.Signals 2
      uart-11.set 0 --level=1 --period=uart-period
      uart-11.set 1 --level=1 --period=uart-period
    
      encoder := rmt.Encoder
          --msb=false  // UART is LSB first.
          --start=uart-start
          --between=uart-between
          --stop=uart-stop
          {
            0b00: uart-00,
            0b01: uart-01,
            0b10: uart-10,
            0b11: uart-11,
          }
    
      out-channel.write "hello" --encoder=encoder --done-level=1
  • a

    Arubinu

    05/02/2025, 12:37 AM
    Do you have a channel where we can show our projects and their sources?
  • k

    kasperl

    05/02/2025, 6:26 AM
    We do now: #1367748896633262131 🙂
  • i

    Ipotex

    05/02/2025, 6:33 PM
    Hi!, hope you're doing well. I'm back at it with the provisioning setup. I'm trying to create a custom characteristic that I want to use to send a token to the device during provisioning. The idea is to send it right after the Wi-Fi scan. I've even tried doing it at other points, but I keep getting the same result. Even though I'm able to send and receive through the characteristic, when I try to continue with the provisioning, I hit this error:
    Copy code
    ******************************************************************************
    Decoding by `jag`, device has version <2.0.0-alpha.179>
    ******************************************************************************
    EXCEPTION error. 
    DEADLINE_EXCEEDED
      0: ble-run-with-quota-backoff_ <sdk>/ble/ble.toit:1363:47
      1: ble-set-value_            <sdk>/ble/ble.toit:1299:3
      2: LocalCharacteristic.set-value <sdk>/ble/local.toit:417:5
      3: RpcService.run_.<block>   <pkg:toit-provision>/src_/rpc.toit:75:25
      4: LocalCharacteristic.handle-request_.<block>.<block> <sdk>/ble/local.toit:514:15
      5: LocalCharacteristic.handle-request_.<block> <sdk>/ble/local.toit:498:5
      6: LocalCharacteristic.handle-request_ <sdk>/ble/local.toit:492:3
      7: LocalCharacteristic.handle-write-request <sdk>/ble/local.toit:490:5
      8: RpcService.run_           <pkg:toit-provision>/src_/rpc.toit:71:23
      9: RpcService.<lambda>       <pkg:toit-provision>/src_/rpc.toit:56:20
    ******************************************************************************
  • f

    floitsch

    05/02/2025, 6:33 PM
    Can you show the new code?
  • i

    Ipotex

    05/02/2025, 6:34 PM
    Hi 🙂
  • i

    Ipotex

    05/02/2025, 6:35 PM
    Copy code
    import ble
    import encoding.json
    import io
    
    import .rpc
    import .security
    
    class CustomRpcService extends RpcService:
      static ID_ ::= 0x54
      static DESCRIPTION_ ::= "custom-service"
    
      custom-service-callback_/Lambda
    
      constructor service/ble.LocalService --custom-service-callback/Lambda? --security/Security:
        custom-service-callback_ = custom-service-callback
        super service ID_
            --description=DESCRIPTION_
            --security=security
             
    
      handle-request data/ByteArray -> ByteArray:      
        return custom-service-callback_.call data  `
  • i

    Ipotex

    05/02/2025, 6:36 PM
    in ble.toit I made this change
    Copy code
    constructor --.name
          --security-credentials/SecurityCredentials?
          --custom-callback/Lambda
          --done/Lambda
          --auto-save/bool:
        adapter = ble.Adapter
        peripheral = adapter.peripheral
        service = peripheral.add-service (ble.BleUuid SERVICE-UUID)
        security := security-for --credentials=security-credentials
    
        rpc-services_ = [
          ScanRpcService service --security=security,
          SessionRpcService service --security=security,
          WifiConfigRpcService service --security=security --done=done --auto-save=auto-save,
          VersionRpcService service --security-version=security.version,
          CustomRpcService service --security=security --custom-service-callback=custom-callback,
        ]
  • i

    Ipotex

    05/02/2025, 6:38 PM
    and change provision.toit for use callback to
    Copy code
    constructor name/string
          --custom-service-callback/Lambda = null
          --security-credentials/SecurityCredentials?=null
          --auto-save/bool=true:
        done-latch := monitor.Latch
        done-latch_ = done-latch
        ble_ = BleProvision
            --name=name
            --security-credentials=security-credentials
            --done=:: done-latch.set it
            --auto-save=auto-save
            --custom-callback= custom-service-callback
  • f

    floitsch

    05/02/2025, 6:39 PM
    Ok. I'm currently not at my computer, but I will try to have a look in ~30 minutes.
  • i

    Ipotex

    05/02/2025, 6:40 PM
    I use it like this in my code :
    Copy code
    prov := provision.Provision service-name --auto-save=false --security-credentials=credentials --custom-service-callback=::setActivationToken it`
  • i

    Ipotex

    05/02/2025, 6:42 PM
    and I define the callback
    Copy code
    setActivationToken data/ByteArray -> ByteArray:     
        activationToken = data
        encoded := base64.encode activationToken
        crc/int := crc.crc32 encoded  
        log.info crc.stringify
        return crc.stringify.to-byte-array
  • i

    Ipotex

    05/02/2025, 6:45 PM
    This works for me — I send the token, get the CRC back, everything’s perfect. But when the provisioning continues, that’s when the error above happens.
  • i

    Ipotex

    05/02/2025, 6:48 PM
    I also tried using proto, but got the same result. I’ve tried sending the command before the WiFi scan, after the scan — same error every time. Tried it on iOS and Android, still the same. I’m out of ideas at this point 🙂
  • i

    Ipotex

    05/02/2025, 6:53 PM
    BTW , Jaguar is disabled
  • thank you! I'll be here 🙂
    i

    Ipotex

    05/02/2025, 6:53 PM
    thank you! I'll be here 🙂
    f
    • 2
    • 32
  • Genesis - Axiometa
    p

    P. Dumcius

    05/04/2025, 8:35 PM
    Hey all! I’m working on an open-source hardware platform called Genesis, built around the ESP32-S3 and designed for building fun projects using compact, swappable modules. We call them AX22 modules – they’re 22x22mm, plug-and-play, and cover everything from sensors to displays to I2C/SPI components. It’s like a smarter, cleaner alternative to breadboards — made to scale from beginner setups to more advanced embedded systems. I’ve already tested it with Toit, and it was loads of fun — super fast to iterate and combine modules. I’m currently looking for a few beta testers from the ESP32/Toit community as I would love to launch it (https://www.crowdsupply.com/axiometa/genesis-iot-discovery-lab). If you're into embedded systems and enjoy trying new tools, I’d love to send you a board for feedback and experimentation. Just reply here or DM me if you’re interested — would be great to have your input! https://axiometa.ai/genesis/
    b
    • 2
    • 1
  • k

    kaxori

    05/05/2025, 5:52 PM
    -> Comparison of small ESP32 boards for your Toit projects:

    https://www.youtube.com/watch?v=hBBORq_yHrwâ–¾

  • s

    swr1211

    05/07/2025, 10:15 AM
    Hi there. 🙂 I saw an introduction video by Kasper Lund on the Toit virtual machine. I'm working with embedded software at the company Danfoss in Denmark. Can you tell me how I can get in contact with Kasper?
  • k

    kasperl

    05/07/2025, 10:17 AM
    I am here! I'll send you a DM 🙂
  • s

    swr1211

    05/07/2025, 10:22 AM
    Super thanks.