chinsumochi — Aitewinrobot Esp32C3 Supermini simulation

An interactive Aitewinrobot Esp32C3 Supermini circuit simulation you can run free in your browser on Velxio, by hgducthanh.

Components

Sketch code

// dasai-mochi-final.ino — Mochi V1 by ducthanh (2026-11-22)
// Firmware V1. Based on the verified DeepSeek v2.3 base.
// v2.3 (DeepSeek, applied): status-bar string cache, arithmetic battery
// right-X, status-bar refresh on battery % change, drawBattery reuses the
// battery cache, u32toa fast path + u8toa2 always_inline, boot Serial
// "Touch:" gated behind DEBUG_SERIAL, enterMode invalidates the status
// cache. NOT applied (DeepSeek items 9/10, parent decision): the menu
// slide-in animation + footer gradient dither are KEPT (v2.2 polish);
// fonts stay 6x10 (menu) / 10x20 (clock) — DeepSeek's 5x8/9x18 fonts
// were not in the code it sent and are unverified. qgif_player.h,
// emotes.h, QGIF blob untouched (DeepSeek's rewritten player was wrong).
// V1 final (2026-11-22, DeepSeek + ChatGPT review synthesis -- see
// README.md "Ban V1 final"): fav buffers 1280, int32/int64 clock,
// ADC 11 dB attenuation (real ESP32 only), stopwatch MM:SS.cc with
// u32toa minutes, border-only Timer Done flash, Timer Run progress
// bar, hourFmt NVS guard, Nokia title-over-icon + ease-out menu,
// icon static_asserts, formatClockHM buffer check, blinking clock
// colon, clock redraw skipped when !clockValid, sys_idle no longer
// re-played when it is the next emote after an ONCE, drawPicker
// renderOnly() removed (every caller already rendered), USB bolt +
// "USB" on the Battery screen, drawOptionList count==0 guard,
// Timer Done hint "1: cham de tat".
// V1 changes over v2.3:
//   * ChatGPT Phase-1 features (mood system, idle personality, pet
//     XP/level) REMOVED at the user's request; AUTO is sequential
//     again, exactly as in v2.2. "by ducthanh" is back on Thong tin.
//   * NK_CLOCK icon redrawn: the old array had 130 bytes (2 extra),
//     which shifted the bitmap and rendered as two mirrored half
//     clocks; the new icon is exactly 128 bytes (32x32, circle +
//     10:10 hands + centre dot).
// NO changes to: qgif_player.h, emotes.h, QGIF blob, UI strings,
// variable names, touch semantics, PLAY_FIXED preview, USB mode,
// 64-bit clock, reset-defaults confirmation, speed labels,
// stopwatch, timer rounding, emote-loop-boundary switching.
//
// PARTITION (BAT BUOC): Huge APP (3MB No OTA/1MB SPIFFS) — REQUIRED.
// Do du lieu QGIF 1.441.262 byte + code ~350 KB, vuot partition
// mac dinh 1,31 MB.
//
// Screen: change SCREEN_TYPE (0 = SSD1306 0.96", 1 = SH1106 1.3",
// 2 = SSD1309 1.54"). All 128x64, player renders 1:1.
#ifndef SCREEN_TYPE
#define SCREEN_TYPE 0
#endif

#include <U8g2lib.h>
#include <Wire.h>
#include <string.h>
#include "emotes.h"
#include "qgif_data.h"
#include "qgif_player.h"

// ---- Persistent settings ----
#ifndef HAS_PREFERENCES
#if defined(__has_include)
#if __has_include(<Preferences.h>)
#define HAS_PREFERENCES 1
#else
#define HAS_PREFERENCES 0
#endif
#else
#define HAS_PREFERENCES 0
#endif
#endif
#if HAS_PREFERENCES
#include <Preferences.h>
#endif

static_assert(sizeof(QGIF_BLOB) == QGIF_BLOB_SIZE,
              "QGI

More projects by hgducthanh