Skip to content

Instantly share code, notes, and snippets.

@GOROman
Last active May 24, 2026 07:33
Show Gist options
  • Select an option

  • Save GOROman/7bfc3d51c512ced18ec1124295666821 to your computer and use it in GitHub Desktop.

Select an option

Save GOROman/7bfc3d51c512ced18ec1124295666821 to your computer and use it in GitHub Desktop.
NullEvi ESP Now

• 今の ESP-NOW はこの 16 byte 固定パケットです。

  #define NULLEVI_BEAT_VERSION 1
  #define NULLEVI_ESPNOW_CHANNEL 1
  #define NULLEVI_BEAT_FLAG_CELEBRATION 0x80

  typedef struct __attribute__((packed)) {
      uint8_t version;       // 1
      uint8_t flags;         // 0x00 通常 / 0x80 祝福
      uint16_t bpm_x10;      // BPM x10, 例: 1200 = 120.0 BPM
      uint32_t seq;          // 重複排除用シーケンス
      uint32_t timestamp_ms; // 送信側時刻
      uint8_t strength;      // 0-255
      uint8_t reserved[3];   // 予約
  } nullevi_beat_event_t;

送信:

  • MAC: ff:ff:ff:ff:ff:ff ブロードキャスト
  • Channel: 1
  • Wi-Fi IF: WIFI_IF_STA
  • 暗号化: なし

意味:

  • 通常 Beat: flags = 0x00
    • Stack-chan / AtomS3 が白フラッシュ、LED beat など
  • 祝福開始/継続: flags = 0x80
    • AtomS3 ダブルタップで送信
    • Stack-chan が受信すると親として祝福モード開始
    • Stack-chan は祝福中、同じ flags=0x80 を全デバイスへブロードキャスト
  • 祝福最後の白フラッシュ: flags = 0x00, strength = 255, bpm_x10 = 1200

受信側は version == 1 と sizeof(nullevi_beat_event_t) を見て、同じ seq は重複として無視していま す。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment