Skip to content

Add t23_lite_litokam-p1t device profile (Litokam P1t / Galayou G2, T23N, ATBM6012B) - #215

Open
wberube wants to merge 9 commits into
OpenIPC:masterfrom
wberube:add-t23n-litokam-p1t
Open

wberube wants to merge 9 commits into
OpenIPC:masterfrom
wberube:add-t23n-litokam-p1t

Conversation

@wberube

@wberube wberube commented Oct 29, 2026

Copy link
Copy Markdown
Member

Adds the Litokam P1t, also sold as the Galayou G2: T23N, SC2336 sensor,
8 MB NOR and a pan/tilt stage.

  • The profile follows t23_lite_lsc-3215672, the only T23 that scopes its
    sensor, which keeps the other 13 sensor blobs out of the rootfs.
  • The stage travels 3982/796 steps with rest at the midpoint (1991/398), the
    values the factory firmware uses. The web UI calls
    gpio-motors <pan> <tilt> <delay>, so the profile ships a shim of that name
    that tracks position across calls, clamps a move to the travel left rather
    than jamming the stage against its end stop, and homes the pan axis on first
    boot. BR2_PACKAGE_GPIO_MOTORS is dropped for the same reason.
  • The excludes list names the isvp_pike module path that
    t23.generic.config sets; the sibling T23 lists use isvp_swan, which is
    the T31 path and matches nothing.
  • The second commit adds a generic JZMMC_V12_MMC0_1BIT option for the single
    data line on MSC0. The option and the mmc.c change are Godmar Back's,
    taken from the Galayou G2 bring-up done for Thingino.
  • Adds the README rows and the Galayou G2 alias.

Not verified on hardware yet: the coil order and pin numbers, the speaker, the
LED and reset button, and whether the stage's end stops are where the travel
figures assume.

…3N, ATBM6012B)

SC2336 sensor, 8 MB NOR, pan/tilt stage. The profile follows
t23_lite_lsc-3215672, the only T23 that scopes its sensor, which drops
the other 13 sensor blobs from the rootfs.

The stage travels 3982/796 steps with rest at the midpoint (1991/398),
the values the factory firmware uses. The web UI calls
"gpio-motors <pan> <tilt> <delay>", so the profile ships a shim of that
name that tracks position across calls, clamps a move to the travel
left, and homes the pan axis on first boot; BR2_PACKAGE_GPIO_MOTORS is
dropped for the same reason. The excludes list names the isvp_pike
module path that t23.generic.config sets, where the sibling T23 lists
name isvp_swan and match nothing.

Not verified on hardware: coil order and pins, the speaker, LED and
reset button, and the stage's end stops.
The SD slot on the Galayou G2 / Litokam P1t (T23N) has a single data line, but
the MSC0 host controller powers up advertising 4-bit transfers and the T23
board data sets MMC_CAP_4_BIT_DATA unconditionally, so the card is negotiated
in 4-bit mode and never enumerates.

Add a JZMMC_V12_MMC0_1BIT Kconfig option that drops the 4-bit capability from
the mmc0 platform data, enable it from the defconfig through a config
fragment, and record the constraint there.

The option and the mmc.c change are Godmar Back's, taken from the Galayou G2
bring-up done for Thingino.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add Litokam P1t / Galayou G2 T23N device profile

✨ Enhancement ⚙️ Configuration changes 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add a T23N profile for the Litokam P1t and Galayou G2, with scoped SC2336 support.
• Add bounded pan/tilt control and restrict MSC0 to one-bit transfers for the board’s SD slot.
• Document the device alias; motor wiring, peripherals, and end stops still need hardware
 validation.
Diagram

graph TD
  Profile["Device profile"] --> Fragment["MMC fragment"] --> Patch["Kernel patch"] --> Host["MSC0 host"] --> Card["SD card"]
  Profile --> Overlay["Board overlay"] --> Shim["PTZ shim"] --> Stage["Pan tilt stage"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Extend the shared gpio-motors package
  • ➕ Keeps motor control in a single maintained implementation.
  • ➕ Could make position tracking reusable across other boards.
  • ➖ Requires changing shared behavior for a board-specific stage.
  • ➖ Adds integration and regression scope beyond this profile.

Recommendation: Keep the board-local motor shim and opt-in kernel MMC option: they isolate hardware-specific behavior without changing other T23 profiles. Consider a shared motor implementation if more boards need persistent position tracking; validate pins, coil order, end stops, and peripherals on hardware before treating this profile as complete.

Files changed (12) +563 / -0

Enhancement (3) +346 / -0
gpio-motorsAdd position-aware pan/tilt motor control +263/-0

Add position-aware pan/tilt motor control

• Provides the web UI's gpio-motors command with persistent position and phase, travel clamping, move locking, and homing. Drives the configured GPIO coils using half-step sequences.

devices/t23_lite_litokam-p1t/general/overlay/usr/bin/gpio-motors

resetd.shMonitor the reset button +37/-0

Monitor the reset button

• Reads the configured reset GPIO and invokes firstboot after a sustained press, flashing the configured LED beforehand.

devices/t23_lite_litokam-p1t/general/overlay/usr/sbin/resetd.sh

0001-jzmmc-v12-add-mmc0-1bit-option.patchAdd an opt-in one-bit MMC0 kernel capability +46/-0

Add an opt-in one-bit MMC0 kernel capability

• Introduces JZMMC_V12_MMC0_1BIT and removes MMC_CAP_4_BIT_DATA from T23 MMC0 platform data when selected, allowing one-bit SD-card negotiation.

devices/t23_lite_litokam-p1t/general/package/all-patches/linux/0001-jzmmc-v12-add-mmc0-1bit-option.patch

Documentation (1) +2 / -0
README.mdList the Litokam P1t and Galayou G2 alias +2/-0

List the Litokam P1t and Galayou G2 alias

• Adds the P1t's T23N, SC2336, Wi-Fi, and flash details to the device table. Maps the Galayou G2 retail name to the Litokam P1t profile.

README.md

Other (8) +215 / -0
t23_litokam-mmc.fragmentSelect one-bit MSC0 operation +5/-0

Select one-bit MSC0 operation

• Enables the new kernel option for this board's single-data-line SD slot.

devices/t23_lite_litokam-p1t/br-ext-chip-ingenic/board/t23/t23_litokam-mmc.fragment

t23_lite_litokam-p1t_defconfigDefine the T23N Litokam P1t build +74/-0

Define the T23N Litokam P1t build

• Configures the lite firmware for the SC2336 sensor, 8 MB NOR, ATBM6012B USB Wi-Fi, and MMC fragment. Omits the packaged gpio-motors implementation in favor of the board overlay shim.

devices/t23_lite_litokam-p1t/br-ext-chip-ingenic/configs/t23_lite_litokam-p1t_defconfig

rc.localStart reset monitoring and Majestic watchdog +20/-0

Start reset monitoring and Majestic watchdog

• Starts the reset-button daemon and periodically restarts Majestic if it is not running.

devices/t23_lite_litokam-p1t/general/overlay/etc/rc.local

usbLoad the board's USB Wi-Fi module +14/-0

Load the board's USB Wi-Fi module

• Recognizes the P1t wireless-device identifier and loads atbm6012b_wifi_usb.

devices/t23_lite_litokam-p1t/general/overlay/etc/wireless/usb

customizer.shSeed board-specific firmware settings +68/-0

Seed board-specific firmware settings

• Sets the upgrade URL, video and audio defaults, Wi-Fi identifier, motor pins and travel, MMC GPIO, and memory reservations.

devices/t23_lite_litokam-p1t/general/overlay/usr/share/openipc/customizer.sh

gpio.confDeclare peripheral GPIO assignments +13/-0

Declare peripheral GPIO assignments

• Provides reset, IR-cut, LED, light, and speaker GPIO values for board scripts.

devices/t23_lite_litokam-p1t/general/overlay/usr/share/openipc/gpio.conf

muxes.shInitialize the LED and untracked motor stage +13/-0

Initialize the LED and untracked motor stage

• Turns off the LED and launches motor homing when no saved PTZ position exists.

devices/t23_lite_litokam-p1t/general/overlay/usr/share/openipc/muxes.sh

t23_lite.listExclude unused modules from the T23 lite image +8/-0

Exclude unused modules from the T23 lite image

• Lists unused modules under the isvp_pike kernel path used by the T23 configuration, rather than the nonmatching isvp_swan path.

devices/t23_lite_litokam-p1t/general/scripts/excludes/t23_lite.list

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Tilt movements use the wrong starting point ✓ Resolved Bug Correctness
Description
home() sweeps only pan, then moves tilt by REST_Y relative steps and saves POS_Y=REST_Y
without establishing tilt’s physical origin. When first-boot homing runs with tilt anywhere other
than its zero stop, later moves clamp against a position that does not match the stage.

2. One motor changes the other's coil phase ✓ Resolved Bug Correctness
Description
step_one() updates a single PHASE for either axis, and the state file persists only that shared
value. Alternating pan and tilt steps makes each motor receive a different sequence than it would
during a single-axis move, so switching between those moves can energize an axis at the wrong next
phase.

3. Overlapping moves lose the stage position ✓ Resolved Bug Correctness
Description
main() calls load_state before acquiring the movement lock, so a waiting invocation retains the
position and phase it read before the preceding move. When two commands overlap, the second clamps
from that stale position and overwrites the first command’s saved result, potentially driving past
the intended travel limit.


Remediation recommended

4. Long delays make later motor moves fail ✓ Resolved Bug Correctness
Description
delay_ms reaches shell arithmetic without numeric or upper-bound validation and is then used for
every step’s usleep. A caller supplying a very large delay can hold the movement lock throughout a
long move, while subsequent commands stop waiting after roughly two seconds and drop their moves.

5. Interrupted moves leave coils energized ✓ Resolved Bug Correctness
Description
acquire_lock() installs a signal trap that removes only the lock, without clearing the GPIO
outputs or terminating movement. If the process is interrupted during a long move, its normal
release_pins call may never run; the lock can also disappear before an interrupted script has
stopped touching the pins.

Grey Divider

Tip of the day
💡 Did you know, you can import rules and skills only from the repositories your team follows

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

wberube and others added 7 commits October 29, 2026 02:20
The pan and tilt coils are separate motors, but step_one() advanced one
shared PHASE and save_state() persisted only that. When step_both()
interleaved them, each axis advanced two phases per iteration and skipped
alternate half-steps; after a single-axis move the other axis resumed at a
phase the first one had advanced.

Track PHASE_P and PHASE_T separately. A state file from the shared-phase
format seeds both from the old value.
load_state() ran before acquire_lock(), so a move that had to wait for
another one kept the position and phase it read before that move
finished. It then clamped from the stale value and overwrote the saved
result.

Load the state after the lock is held, on both the home and move paths.
Only the pan and tilt arguments were checked for digits; delay_ms went
straight into shell arithmetic. A non-numeric value broke usleep, and a
very large one held the lock for an impractical time.

Reject a non-numeric delay and clamp it to 1..50 ms, which covers the web
UI's range and keeps the minimum step at 1 ms.
The EXIT/INT/TERM trap removed the lock but left the GPIOs driven, and on
INT/TERM it did not stop the script. An interrupted move could leave the
coils energized, and the lock could disappear while it was still
stepping.

Split the handlers: EXIT unexports the pins this invocation took and
removes the lock; INT/TERM do the same and exit. Take the lock before
exporting, so a move that gives up never touches the pins.
home() swept pan into its stop, then moved tilt by REST_Y from wherever it
happened to be and recorded POS_Y=REST_Y. Tilt was never referenced, so
the absolute tilt clamp was measuring from a position the stage was not
at.

Record a Y_REF flag in the state, home tilt only when ptz_tilt_home=1
(swept towards ptz_tilt_dir) and clamp it only then; otherwise its moves
stay relative. customizer seeds ptz_tilt_home=0 for this stage.
Every other 8 MB T23 profile, t23_lite_lsc-3215672 included, packages its
image with post-image-split.sh; this one predates the move and still built
the fixed layout.

@openipc-ai openipc-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks William, and sorry this has waited so long. I pushed two mechanical fixes to the branch:

  • b501066: merged master. The README alias table conflicted with the HeimVision HM202 rows; both are kept.
  • b0a8462: BR2_ROOTFS_POST_IMAGE_SCRIPT=…/post-image-split.sh. Every 8 MB T23 profile, t23_lite_lsc-3215672 included, moved to the split NOR layout after this PR was opened. Without the line this board would be the only one still on the fixed layout.

The rest reads well. The isvp_pike paths in the exclude list are right (CONFIG_LOCALVERSION="__isvp_pike_1.0__" in t23.generic.config). The 1-bit MSC0 option is a clean #ifdef that changes nothing unless the fragment turns it on.

What's needed before merging is a hardware run. The description lists the coil order, the pins, the speaker, the LED, the reset button and the end stops as not verified. That makes the pan/tilt shim the riskiest part: run with the wrong coil order or travel, it can drive the stage hard into its stop. Could you flash the CI image from this branch and report:

  1. that video and Wi-Fi (atbm601x-t23-litokam-p1t) come up;
  2. whether gpio-motors home and a few WebUI arrow presses move the right axis in the right direction and stop short of the end stops;
  3. the SD card with the 1-bit option.

The speaker, LED and reset button can stay as "untested" in the README row.

Not blocking:

  • /etc/ptz_state is written on every move, which means a jffs2 write to NOR per WebUI click. Keeping the live position in /tmp and persisting it only after a move finishes (or every N seconds) would be gentler on the flash.
  • Homing and position tracking would help other boards too. Upstream gpio-motors (OpenIPC/firmware general/package/gpio-motors) has gained end-switch support since you wrote this. A follow-up there could eventually replace the board-local shim.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants