settings.html 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  1. {% extends "base.html" %} {% block title %}Settings - {{ app_name or 'Dune Weaver' }}{%
  2. endblock %}
  3. {% block additional_styles %}
  4. /* Dark mode styles for settings page */
  5. .dark .bg-white {
  6. background-color: #262626;
  7. }
  8. .dark .text-slate-900 {
  9. color: #ffffff;
  10. }
  11. .dark .text-slate-800 {
  12. color: #f8fafc;
  13. }
  14. .dark .text-slate-700 {
  15. color: #f1f5f9;
  16. }
  17. .dark .text-slate-600 {
  18. color: #e2e8f0;
  19. }
  20. .dark .text-slate-500 {
  21. color: #e2e8f0;
  22. }
  23. /* Label overrides for better visibility */
  24. .dark label {
  25. color: #f1f5f9;
  26. }
  27. .dark .border-slate-200 {
  28. border-color: #404040;
  29. }
  30. .dark .border-slate-300 {
  31. border-color: #404040;
  32. }
  33. .dark .divide-slate-100 {
  34. border-color: #404040;
  35. }
  36. .dark .bg-slate-50 {
  37. background-color: #262626;
  38. }
  39. .dark .hover\:bg-slate-50:hover {
  40. background-color: #404040;
  41. }
  42. .dark .bg-slate-100 {
  43. background-color: #404040;
  44. }
  45. .dark .form-input,
  46. .dark input[type="number"],
  47. .dark input[type="text"],
  48. .dark input[type="time"] {
  49. background-color: #1f1f1f;
  50. border-color: #404040;
  51. color: #e5e5e5;
  52. }
  53. .dark .form-input::placeholder {
  54. color: #9ca3af;
  55. }
  56. .dark .form-input:focus {
  57. border-color: #0c7ff2;
  58. ring-color: #0c7ff2;
  59. }
  60. .dark input[type="time"]::-webkit-calendar-picker-indicator {
  61. filter: invert(1);
  62. }
  63. .dark .form-select {
  64. background-color: #1f1f1f;
  65. border-color: #404040;
  66. color: #e5e5e5;
  67. }
  68. .dark .form-select:focus {
  69. border-color: #0c7ff2;
  70. ring-color: #0c7ff2;
  71. }
  72. .dark .focus\:ring-sky-500:focus {
  73. ring-color: #0c7ff2;
  74. }
  75. .dark .focus\:border-sky-500:focus {
  76. border-color: #0c7ff2;
  77. }
  78. .dark .hover\:text-gray-700:hover {
  79. color: #e5e5e5;
  80. }
  81. .dark .text-gray-400 {
  82. color: #9ca3af;
  83. }
  84. /* Autocomplete suggestions dark mode */
  85. .dark #clearFromInSuggestions,
  86. .dark #clearFromOutSuggestions {
  87. background-color: #262626;
  88. border-color: #404040;
  89. }
  90. .dark .suggestion-item {
  91. color: #e5e5e5;
  92. }
  93. .dark .suggestion-item:hover {
  94. background-color: #404040;
  95. }
  96. .dark .suggestion-item.selected {
  97. background-color: #0c7ff2;
  98. color: white;
  99. }
  100. /* Light mode autocomplete styles */
  101. .suggestion-item {
  102. padding: 8px 12px;
  103. cursor: pointer;
  104. color: #1f2937;
  105. transition: background-color 0.15s;
  106. }
  107. .suggestion-item:hover {
  108. background-color: #f3f4f6;
  109. }
  110. .suggestion-item.selected {
  111. background-color: #0c7ff2;
  112. color: white;
  113. }
  114. .suggestion-item mark {
  115. background-color: #fef3c7;
  116. font-weight: 600;
  117. }
  118. .dark .suggestion-item mark {
  119. background-color: #92400e;
  120. color: #fef3c7;
  121. }
  122. /* Toggle switch styles */
  123. .switch {
  124. position: relative;
  125. display: inline-block;
  126. width: 60px;
  127. height: 34px;
  128. }
  129. .switch input {
  130. opacity: 0;
  131. width: 0;
  132. height: 0;
  133. }
  134. .slider {
  135. position: absolute;
  136. cursor: pointer;
  137. top: 0;
  138. left: 0;
  139. right: 0;
  140. bottom: 0;
  141. background-color: #ccc;
  142. transition: .4s;
  143. }
  144. .slider:before {
  145. position: absolute;
  146. content: "";
  147. height: 26px;
  148. width: 26px;
  149. left: 4px;
  150. bottom: 4px;
  151. background-color: white;
  152. transition: .4s;
  153. }
  154. input:checked + .slider {
  155. background-color: #0c7ff2;
  156. }
  157. input:focus + .slider {
  158. box-shadow: 0 0 1px #0c7ff2;
  159. }
  160. input:checked + .slider:before {
  161. transform: translateX(26px);
  162. }
  163. .slider.round {
  164. border-radius: 34px;
  165. }
  166. .slider.round:before {
  167. border-radius: 50%;
  168. }
  169. /* Dark mode for switches */
  170. .dark .slider {
  171. background-color: #404040;
  172. }
  173. .dark input:checked + .slider {
  174. background-color: #0c7ff2;
  175. }
  176. /* Spin animation for loading states */
  177. @keyframes spin {
  178. from {
  179. transform: rotate(0deg);
  180. }
  181. to {
  182. transform: rotate(360deg);
  183. }
  184. }
  185. .animate-spin {
  186. animation: spin 1s linear infinite;
  187. }
  188. /* Time slot specific styles */
  189. .time-slot-item {
  190. background-color: #f8fafc;
  191. border: 1px solid #e2e8f0;
  192. border-radius: 8px;
  193. padding: 16px;
  194. transition: all 0.15s;
  195. }
  196. .dark .time-slot-item {
  197. background-color: #1e293b;
  198. border-color: #475569;
  199. }
  200. .time-slot-item:hover {
  201. border-color: #cbd5e1;
  202. }
  203. .dark .time-slot-item:hover {
  204. border-color: #64748b;
  205. }
  206. /* Info box dark mode - grey theme */
  207. .dark .bg-blue-50 {
  208. background-color: #1f1f1f;
  209. }
  210. .dark .border-blue-200 {
  211. border-color: #404040;
  212. }
  213. .dark .text-blue-600 {
  214. color: #e2e8f0;
  215. }
  216. .dark .text-blue-800 {
  217. color: #f1f5f9;
  218. }
  219. .dark .text-blue-700 {
  220. color: #e2e8f0;
  221. }
  222. /* Amber box dark mode - grey theme */
  223. .dark .bg-amber-50 {
  224. background-color: #1f1f1f;
  225. }
  226. .dark .border-amber-200 {
  227. border-color: #404040;
  228. }
  229. .dark .text-amber-600 {
  230. color: #f1f5f9;
  231. }
  232. {% endblock %}
  233. {% block content %}
  234. <div class="layout-content-container flex flex-col w-full max-w-4xl gap-8 pt-2 pb-[75px]">
  235. <div
  236. class="flex flex-wrap justify-between items-center p-4 bg-white rounded-xl shadow-sm mt-2 sm:mt-8"
  237. >
  238. <h1
  239. class="text-slate-900 tracking-tight text-2xl sm:text-3xl font-bold leading-tight"
  240. >
  241. Settings
  242. </h1>
  243. </div>
  244. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  245. <h2
  246. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  247. >
  248. Device Connection
  249. </h2>
  250. <div class="divide-y divide-slate-100">
  251. <div
  252. class="flex items-center gap-4 px-6 py-5 hover:bg-slate-50 transition-colors"
  253. >
  254. <div
  255. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  256. >
  257. <span class="material-icons text-3xl">usb_off</span>
  258. </div>
  259. <div class="flex-1">
  260. <p class="text-slate-800 text-base font-medium leading-normal">
  261. Status
  262. </p>
  263. <p
  264. id="serialStatus"
  265. class="text-red-500 text-sm font-medium leading-normal"
  266. >
  267. Disconnected
  268. </p>
  269. </div>
  270. <button
  271. id="disconnectButton"
  272. class="text-xs font-medium text-slate-600 bg-red-100 hover:bg-red-200 text-red-700 px-3 py-1.5 rounded-md transition-colors"
  273. hidden
  274. >
  275. Disconnect
  276. </button>
  277. </div>
  278. <div id="portSelectionDiv" class="px-6 py-5 space-y-4">
  279. <label class="flex flex-col gap-1.5">
  280. <span class="text-slate-700 text-sm font-medium leading-normal"
  281. >Available Serial Ports</span
  282. >
  283. <div class="flex gap-3 items-center">
  284. <select
  285. id="portSelect"
  286. class="form-select flex-1 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-medium leading-normal transition-colors "
  287. >
  288. <option value="">Select a port...</option>
  289. </select>
  290. <button
  291. id="connectButton"
  292. class="flex items-center justify-center gap-2 min-w-[100px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors flex-shrink-0"
  293. >
  294. <span class="material-icons text-lg">cable</span>
  295. <span class="truncate">Connect</span>
  296. </button>
  297. </div>
  298. <p class="text-xs text-slate-500 mt-2">
  299. Select a port and click 'Connect' to establish a connection.
  300. </p>
  301. </label>
  302. </div>
  303. </div>
  304. </section>
  305. <!-- Homing Configuration Section -->
  306. <section id="homingSection" class="bg-white rounded-xl shadow-sm overflow-hidden">
  307. <h2
  308. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  309. >
  310. Homing Configuration
  311. </h2>
  312. <div class="px-6 py-5 space-y-6">
  313. <!-- Homing Mode Selection -->
  314. <div class="space-y-3">
  315. <label class="text-sm font-medium text-slate-700 flex items-center gap-2">
  316. <span class="material-icons text-slate-600 text-base">home</span>
  317. Homing Mode
  318. </label>
  319. <div class="space-y-3">
  320. <!-- Crash Homing Option -->
  321. <label class="flex items-start gap-3 p-3 border border-slate-300 rounded-lg cursor-pointer hover:bg-slate-50 transition-colors">
  322. <input
  323. type="radio"
  324. name="homingMode"
  325. value="0"
  326. id="homingModeCrash"
  327. class="mt-0.5 w-4 h-4 text-sky-600 focus:ring-sky-500"
  328. />
  329. <div class="flex-1">
  330. <div class="text-sm font-medium text-slate-700">Crash Homing</div>
  331. <div class="text-xs text-slate-500 mt-1">
  332. Y axis moves until physical stop, then theta and rho set to 0 (no x0 y0 command)
  333. </div>
  334. </div>
  335. </label>
  336. <!-- Sensor Homing Option -->
  337. <label class="flex items-start gap-3 p-3 border border-slate-300 rounded-lg cursor-pointer hover:bg-slate-50 transition-colors">
  338. <input
  339. type="radio"
  340. name="homingMode"
  341. value="1"
  342. id="homingModeSensor"
  343. class="mt-0.5 w-4 h-4 text-sky-600 focus:ring-sky-500"
  344. />
  345. <div class="flex-1">
  346. <div class="text-sm font-medium text-slate-700">Sensor Homing</div>
  347. <div class="text-xs text-slate-500 mt-1">
  348. Homes both X and Y axes using sensors
  349. </div>
  350. </div>
  351. </label>
  352. </div>
  353. </div>
  354. <!-- Compass Reference Point (Sensor mode only) -->
  355. <div id="compassOffsetContainer" class="space-y-2">
  356. <label for="angularOffsetInput" class="text-sm font-medium text-slate-700 flex items-center gap-2">
  357. <span class="material-icons text-slate-600 text-base">explore</span>
  358. Sensor offset (degrees) <span class="text-xs text-slate-400">(Sensor mode only)</span>
  359. </label>
  360. <input
  361. type="number"
  362. id="angularOffsetInput"
  363. min="0"
  364. max="360"
  365. step="0.1"
  366. value="0"
  367. class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 text-sm"
  368. placeholder="0.0"
  369. />
  370. <p class="text-xs text-slate-500">
  371. Set the angle (in degrees) where your radial arm to be offset by. You want to choose a value here so that the radial arm will point East.
  372. </p>
  373. </div>
  374. <!-- Homing Info Box -->
  375. <div id="homingInfoBox" class="text-xs text-slate-600 bg-blue-50 border border-blue-200 rounded-lg p-3">
  376. <div class="flex items-start gap-2">
  377. <span class="material-icons text-blue-600 text-base">info</span>
  378. <div id="homingInfoContent">
  379. <p class="font-medium text-blue-800">Crash Homing Mode:</p>
  380. <ul class="mt-1 space-y-1 text-blue-700">
  381. <li>• Y axis moves -22mm (or -30mm for mini) until physical stop</li>
  382. <li>• Theta set to 0, rho set to 0</li>
  383. <li>• No x0 y0 command sent</li>
  384. <li>• No hardware sensors required</li>
  385. </ul>
  386. </div>
  387. </div>
  388. </div>
  389. <div class="flex justify-end">
  390. <button
  391. id="saveHomingConfig"
  392. class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  393. >
  394. <span class="material-icons text-lg">save</span>
  395. <span class="truncate">Save Configuration</span>
  396. </button>
  397. </div>
  398. </div>
  399. </section>
  400. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  401. <h2
  402. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  403. >
  404. Application Settings
  405. </h2>
  406. <div class="px-6 py-5 space-y-6">
  407. <label class="flex flex-col gap-1.5">
  408. <span class="text-slate-700 text-sm font-medium leading-normal"
  409. >Application Name</span
  410. >
  411. <div class="flex gap-3 items-center">
  412. <div class="relative flex-1">
  413. <input
  414. id="appNameInput"
  415. class="form-input flex w-full min-w-0 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 pr-10 text-base font-normal leading-normal transition-colors"
  416. placeholder="e.g., Dune Weaver"
  417. value="Dune Weaver"
  418. />
  419. <button
  420. type="button"
  421. onclick="document.getElementById('appNameInput').value='Dune Weaver';"
  422. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  423. aria-label="Reset to default"
  424. title="Reset to default"
  425. >
  426. <span class="material-icons">restart_alt</span>
  427. </button>
  428. </div>
  429. <button
  430. id="saveAppName"
  431. class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors flex-shrink-0"
  432. >
  433. <span class="material-icons text-lg">save</span>
  434. <span class="truncate">Save Name</span>
  435. </button>
  436. </div>
  437. <p class="text-xs text-slate-500 mt-2">
  438. This name will appear in the browser tab and at the top of every page.
  439. </p>
  440. </label>
  441. </div>
  442. </section>
  443. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  444. <h2
  445. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  446. >
  447. Pattern Clearing
  448. </h2>
  449. <div class="px-6 py-5 space-y-6">
  450. <p class="text-sm text-slate-600">
  451. Customize the clearing behavior used when transitioning between patterns. Set custom patterns and speed to control how sand is distributed.
  452. </p>
  453. <!-- Clearing Speed Section -->
  454. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  455. <h3 class="text-slate-800 text-base font-semibold">Clearing Speed</h3>
  456. <p class="text-sm text-slate-600">
  457. Set a custom speed for clearing patterns. Leave empty to use the default pattern speed. This allows clearing patterns to run at a different speed than regular patterns.
  458. </p>
  459. <div class="flex flex-col gap-1.5">
  460. <label for="clearPatternSpeedInput" class="text-slate-700 text-sm font-medium leading-normal">
  461. Speed (steps per minute)
  462. </label>
  463. <div class="flex gap-3 items-center">
  464. <input
  465. id="clearPatternSpeedInput"
  466. type="number"
  467. min="50"
  468. max="2000"
  469. step="50"
  470. class="form-input flex-1 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-normal leading-normal transition-colors"
  471. placeholder="Default (use pattern speed)"
  472. value=""
  473. />
  474. <button
  475. id="saveClearSpeed"
  476. class="flex items-center justify-center gap-2 min-w-[120px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  477. >
  478. <span class="material-icons text-lg">save</span>
  479. <span class="truncate">Save Speed</span>
  480. </button>
  481. </div>
  482. <div id="effectiveClearSpeed" class="text-xs text-slate-500 mt-1"></div>
  483. </div>
  484. </div>
  485. <!-- Custom Patterns Section -->
  486. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  487. <h3 class="text-slate-800 text-base font-semibold">Custom Clear Patterns</h3>
  488. <p class="text-sm text-slate-600">
  489. Choose specific patterns to use when clearing. Leave empty to use the default clearing behavior.
  490. </p>
  491. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  492. <div class="flex flex-col gap-1.5">
  493. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  494. <div class="relative">
  495. <input
  496. id="customClearFromInInput"
  497. type="text"
  498. class="form-input w-full resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 pr-10 text-base font-normal leading-normal transition-colors"
  499. placeholder="Type to search patterns or leave empty for default"
  500. autocomplete="off"
  501. />
  502. <button
  503. type="button"
  504. id="clearFromInClear"
  505. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  506. aria-label="Clear selection"
  507. title="Clear selection"
  508. >
  509. <span class="material-icons text-xl">close</span>
  510. </button>
  511. <div id="clearFromInSuggestions" class="absolute z-10 w-full mt-1 bg-white border border-slate-300 rounded-lg shadow-lg max-h-60 overflow-y-auto hidden"></div>
  512. </div>
  513. <p class="text-xs text-slate-500 mt-1">
  514. Pattern to use when clearing from the center outward.
  515. </p>
  516. </div>
  517. <div class="flex flex-col gap-1.5">
  518. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  519. <div class="relative">
  520. <input
  521. id="customClearFromOutInput"
  522. type="text"
  523. class="form-input w-full resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 pr-10 text-base font-normal leading-normal transition-colors"
  524. placeholder="Type to search patterns or leave empty for default"
  525. autocomplete="off"
  526. />
  527. <button
  528. type="button"
  529. id="clearFromOutClear"
  530. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  531. aria-label="Clear selection"
  532. title="Clear selection"
  533. >
  534. <span class="material-icons text-xl">close</span>
  535. </button>
  536. <div id="clearFromOutSuggestions" class="absolute z-10 w-full mt-1 bg-white border border-slate-300 rounded-lg shadow-lg max-h-60 overflow-y-auto hidden"></div>
  537. </div>
  538. <p class="text-xs text-slate-500 mt-1">
  539. Pattern to use when clearing from the perimeter inward.
  540. </p>
  541. </div>
  542. </div>
  543. <div class="flex justify-end">
  544. <button
  545. id="saveClearPatterns"
  546. class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  547. >
  548. <span class="material-icons text-lg">save</span>
  549. <span class="truncate">Save Patterns</span>
  550. </button>
  551. </div>
  552. </div>
  553. </div>
  554. </section>
  555. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  556. <h2
  557. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  558. >
  559. LED Controller Configuration
  560. </h2>
  561. <div class="px-6 py-5 space-y-6">
  562. <!-- LED Provider Selection -->
  563. <div class="flex flex-col gap-2">
  564. <span class="text-slate-700 text-sm font-medium leading-normal">LED Provider</span>
  565. <div class="flex gap-3">
  566. <label class="flex items-center gap-2 cursor-pointer">
  567. <input type="radio" name="ledProvider" value="none" id="ledProviderNone" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  568. <span class="text-sm text-slate-700">None</span>
  569. </label>
  570. <label class="flex items-center gap-2 cursor-pointer">
  571. <input type="radio" name="ledProvider" value="wled" id="ledProviderWled" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  572. <span class="text-sm text-slate-700">WLED</span>
  573. </label>
  574. <label class="flex items-center gap-2 cursor-pointer">
  575. <input type="radio" name="ledProvider" value="dw_leds" id="ledProviderDwLeds" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  576. <span class="text-sm text-slate-700">DW LEDs (Local GPIO)</span>
  577. </label>
  578. </div>
  579. <p class="text-xs text-slate-500">
  580. Select your LED control system (settings are mutually exclusive)
  581. </p>
  582. </div>
  583. <!-- WLED Configuration (shown when WLED is selected) -->
  584. <div id="wledConfig" class="flex flex-col gap-4 hidden">
  585. <label class="flex flex-col gap-1.5">
  586. <span class="text-slate-700 text-sm font-medium leading-normal">WLED IP Address</span>
  587. <div class="relative flex-1">
  588. <input
  589. id="wledIpInput"
  590. class="form-input flex w-full min-w-0 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 pr-10 text-base font-normal leading-normal transition-colors"
  591. placeholder="e.g., 192.168.1.100"
  592. value=""
  593. />
  594. <button
  595. type="button"
  596. onclick="document.getElementById('wledIpInput').value='';"
  597. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  598. aria-label="Clear WLED IP"
  599. >
  600. <span class="material-icons">close</span>
  601. </button>
  602. </div>
  603. <p class="text-xs text-slate-500">
  604. Enter the IP address of your WLED controller
  605. </p>
  606. </label>
  607. </div>
  608. <!-- DW LEDs Configuration (shown when DW LEDs is selected) -->
  609. <div id="dwLedsConfig" class="flex flex-col gap-4 hidden">
  610. <div class="bg-blue-50 border border-blue-200 rounded-lg p-3">
  611. <div class="flex items-start gap-2">
  612. <span class="material-icons text-blue-600 text-base">info</span>
  613. <div class="text-xs text-blue-700">
  614. <p class="font-medium text-blue-800">Supported LED Strips</p>
  615. <p class="mt-1"><strong>RGB (3-channel):</strong> WS2811, WS2812, WS2812B, WS2813, WS2815 and other WS281x strips.</p>
  616. <p class="mt-1"><strong>RGBW (4-channel):</strong> SK6812, SK6812W and other RGBW strips with dedicated white channel.</p>
  617. </div>
  618. </div>
  619. </div>
  620. <label class="flex flex-col gap-1.5">
  621. <span class="text-slate-700 text-sm font-medium leading-normal">Number of LEDs</span>
  622. <input
  623. id="dwLedNumLeds"
  624. type="number"
  625. class="form-input flex w-full min-w-0 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-normal leading-normal transition-colors"
  626. placeholder="60"
  627. value="60"
  628. min="1"
  629. max="1000"
  630. />
  631. <p class="text-xs text-slate-500">
  632. Total number of LEDs in your WS281x strip
  633. </p>
  634. </label>
  635. <label class="flex flex-col gap-1.5">
  636. <span class="text-slate-700 text-sm font-medium leading-normal">GPIO Pin</span>
  637. <select
  638. id="dwLedGpioPin"
  639. class="form-select flex w-full min-w-0 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 px-4 text-base font-normal leading-normal transition-colors"
  640. >
  641. <option value="12">GPIO 12 (PWM0)</option>
  642. <option value="13">GPIO 13 (PWM1)</option>
  643. <option value="18">GPIO 18 (PWM0)</option>
  644. <option value="19">GPIO 19 (PWM1)</option>
  645. </select>
  646. <p class="text-xs text-slate-500">
  647. Select a PWM-capable GPIO pin for WS281x timing
  648. </p>
  649. </label>
  650. <label class="flex flex-col gap-1.5">
  651. <span class="text-slate-700 text-sm font-medium leading-normal">Pixel Color Order</span>
  652. <select
  653. id="dwLedPixelOrder"
  654. class="form-select flex w-full min-w-0 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 px-4 text-base font-normal leading-normal transition-colors"
  655. >
  656. <optgroup label="RGB Strips (3-channel)">
  657. <option value="GRB" selected>GRB - WS2812/WS2812B (most common)</option>
  658. <option value="RGB">RGB - WS2815/WS2811 and some variants</option>
  659. <option value="BGR">BGR - Some WS2811 variants</option>
  660. <option value="RBG">RBG - Rare variant</option>
  661. <option value="GBR">GBR - Rare variant</option>
  662. <option value="BRG">BRG - Rare variant</option>
  663. </optgroup>
  664. <optgroup label="RGBW Strips (4-channel)">
  665. <option value="GRBW">GRBW - SK6812 RGBW (most common)</option>
  666. <option value="RGBW">RGBW - SK6812 RGBW variant</option>
  667. </optgroup>
  668. </select>
  669. <p class="text-xs text-slate-500">
  670. Most WS2812B strips use GRB. SK6812 RGBW strips typically use GRBW. If colors appear wrong, try different orders.
  671. </p>
  672. </label>
  673. </div>
  674. <!-- Save Button -->
  675. <button
  676. id="saveLedConfig"
  677. class="flex items-center justify-center gap-2 w-full sm:w-auto cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  678. >
  679. <span class="material-icons text-lg">save</span>
  680. <span class="truncate">Save LED Configuration</span>
  681. </button>
  682. </div>
  683. </section>
  684. <!-- Ball Tracking LED Section -->
  685. <section id="ballTrackingSection" class="bg-white rounded-xl shadow-sm overflow-hidden">
  686. <h2
  687. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  688. >
  689. Ball Tracking LEDs
  690. </h2>
  691. <div class="px-6 py-5 space-y-6">
  692. <!-- Info Box -->
  693. <div class="bg-blue-50 border border-blue-200 rounded-lg p-3">
  694. <div class="flex items-start gap-2">
  695. <span class="material-icons text-blue-600 text-base">info</span>
  696. <div class="text-xs text-blue-700">
  697. <p class="font-medium text-blue-800">Track Ball Position with LEDs</p>
  698. <p class="mt-1">Illuminate LEDs that follow the ball bearing's movement around the table in real-time. Requires DW LEDs (local GPIO) configuration.</p>
  699. </div>
  700. </div>
  701. </div>
  702. <!-- Enable Ball Tracking -->
  703. <div class="flex items-center justify-between">
  704. <div class="flex-1">
  705. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Ball Tracking</h3>
  706. <p class="text-xs text-slate-500 mt-1">
  707. Turn on LED tracking of ball bearing position
  708. </p>
  709. </div>
  710. <label class="switch">
  711. <input type="checkbox" id="ballTrackingEnabled">
  712. <span class="slider round"></span>
  713. </label>
  714. </div>
  715. <!-- Tracking Settings (shown when enabled) -->
  716. <div id="ballTrackingSettings" class="space-y-4" style="display: none;">
  717. <!-- Tracking Mode -->
  718. <label class="flex flex-col gap-1.5">
  719. <span class="text-slate-700 text-sm font-medium leading-normal">Tracking Mode</span>
  720. <select
  721. id="ballTrackingMode"
  722. class="form-select resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 px-4 text-base font-medium leading-normal transition-colors"
  723. >
  724. <option value="disabled">Disabled</option>
  725. <option value="playing_only">Only During Pattern Playback</option>
  726. <option value="enabled">Always On</option>
  727. </select>
  728. <p class="text-xs text-slate-500 mt-1">
  729. Control when ball tracking is active
  730. </p>
  731. </label>
  732. <!-- Calibration Button -->
  733. <div class="bg-amber-50 border border-amber-200 rounded-lg p-4">
  734. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  735. <span class="material-icons text-amber-600 text-base">tune</span>
  736. LED Alignment Calibration
  737. </h4>
  738. <p class="text-xs text-slate-600 mt-1 mb-3">
  739. Calibrate which LED corresponds to the 0° position on your table
  740. </p>
  741. <button
  742. id="openCalibrationWizard"
  743. class="flex items-center justify-center gap-2 cursor-pointer rounded-lg h-10 px-4 bg-amber-600 hover:bg-amber-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  744. >
  745. <span class="material-icons text-lg">play_arrow</span>
  746. <span class="truncate">Start Calibration Wizard</span>
  747. </button>
  748. </div>
  749. <!-- Grid of Settings -->
  750. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  751. <!-- LED Spread -->
  752. <label class="flex flex-col gap-1.5">
  753. <span class="text-slate-700 text-sm font-medium leading-normal">LED Spread</span>
  754. <input
  755. id="ballTrackingSpread"
  756. type="range"
  757. min="1"
  758. max="10"
  759. value="3"
  760. class="w-full h-2 bg-slate-200 rounded-lg appearance-none cursor-pointer"
  761. />
  762. <div class="flex justify-between text-xs text-slate-500">
  763. <span>1 LED</span>
  764. <span id="ballTrackingSpreadValue">3 LEDs</span>
  765. <span>10 LEDs</span>
  766. </div>
  767. <p class="text-xs text-slate-500">
  768. Number of adjacent LEDs to light up
  769. </p>
  770. </label>
  771. <!-- Brightness -->
  772. <label class="flex flex-col gap-1.5">
  773. <span class="text-slate-700 text-sm font-medium leading-normal">Brightness</span>
  774. <input
  775. id="ballTrackingBrightness"
  776. type="range"
  777. min="0"
  778. max="100"
  779. value="50"
  780. class="w-full h-2 bg-slate-200 rounded-lg appearance-none cursor-pointer"
  781. />
  782. <div class="flex justify-between text-xs text-slate-500">
  783. <span>0%</span>
  784. <span id="ballTrackingBrightnessValue">50%</span>
  785. <span>100%</span>
  786. </div>
  787. </label>
  788. <!-- Color Picker -->
  789. <label class="flex flex-col gap-1.5">
  790. <span class="text-slate-700 text-sm font-medium leading-normal">Tracking Color</span>
  791. <input
  792. id="ballTrackingColor"
  793. type="color"
  794. value="#ffffff"
  795. class="w-full h-10 rounded-lg cursor-pointer border border-slate-300"
  796. />
  797. <p class="text-xs text-slate-500">
  798. Color of tracking LEDs
  799. </p>
  800. </label>
  801. </div>
  802. <!-- Save Button -->
  803. <div class="flex justify-end">
  804. <button
  805. id="saveBallTrackingConfig"
  806. class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  807. >
  808. <span class="material-icons text-lg">save</span>
  809. <span class="truncate">Save Settings</span>
  810. </button>
  811. </div>
  812. </div>
  813. </div>
  814. </section>
  815. <!-- Calibration Wizard Modal -->
  816. <div id="calibrationModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center p-4">
  817. <div class="bg-white dark:bg-neutral-800 rounded-xl shadow-2xl w-[60%] max-h-[85vh] overflow-y-auto">
  818. <!-- Modal Header -->
  819. <div class="flex items-center justify-between px-6 py-4 border-b border-slate-200">
  820. <h3 class="text-slate-900 text-xl font-semibold">Ball Tracking Calibration</h3>
  821. <button id="closeCalibrationModal" class="text-slate-400 hover:text-slate-600">
  822. <span class="material-icons">close</span>
  823. </button>
  824. </div>
  825. <!-- Modal Content -->
  826. <div class="px-6 py-6">
  827. <!-- Step Indicator -->
  828. <div class="flex items-center justify-between mb-6">
  829. <div class="flex items-center gap-2">
  830. <div id="step1Indicator" class="flex items-center justify-center w-8 h-8 rounded-full bg-sky-600 text-white text-sm font-medium">1</div>
  831. <div class="w-24 h-1 bg-slate-200" id="line1"></div>
  832. <div id="step2Indicator" class="flex items-center justify-center w-8 h-8 rounded-full bg-slate-200 text-slate-500 text-sm font-medium">2</div>
  833. </div>
  834. </div>
  835. <!-- Step 1: Move to Reference -->
  836. <div id="calibrationStep1" class="space-y-4">
  837. <h4 class="text-lg font-medium text-slate-800">Step 1: Move to Reference Position</h4>
  838. <p class="text-sm text-slate-600">
  839. We'll reset theta and move the ball to the reference position (0°, perimeter). This will help us identify which LED corresponds to the 0° position.
  840. </p>
  841. <button
  842. id="startCalibrationMove"
  843. class="flex items-center justify-center gap-2 w-full cursor-pointer rounded-lg h-12 px-4 bg-sky-600 hover:bg-sky-700 text-white text-base font-medium transition-colors"
  844. >
  845. <span class="material-icons text-xl">navigation</span>
  846. <span>Move Ball to Reference Position</span>
  847. </button>
  848. <div id="calibrationMoveStatus" class="hidden text-sm text-slate-600 text-center">
  849. <span class="inline-block animate-spin material-icons text-sky-600">refresh</span>
  850. Moving to reference position...
  851. </div>
  852. </div>
  853. <!-- Step 2: Identify LED & Configure -->
  854. <div id="calibrationStep2" class="space-y-4 hidden">
  855. <h4 class="text-lg font-medium text-slate-800">Step 2: Identify LED Position</h4>
  856. <p class="text-sm text-slate-600">
  857. The ball is at the 0° reference position. Use the buttons below to navigate through your LEDs until the <strong>lit LED matches the ball's position</strong>.
  858. </p>
  859. <!-- Current LED Display -->
  860. <div class="bg-slate-100 dark:bg-slate-700 rounded-lg p-4 text-center">
  861. <p class="text-xs text-slate-600 dark:text-slate-400 mb-1">Currently Selected LED</p>
  862. <p class="text-4xl font-bold text-sky-600" id="currentLedNumber">0</p>
  863. <p class="text-xs text-slate-500 dark:text-slate-400 mt-2" id="ledStatusText">This LED is now lit on your strip</p>
  864. </div>
  865. <!-- Navigation Controls -->
  866. <div class="space-y-3">
  867. <p class="text-xs font-medium text-slate-700 dark:text-slate-300 text-center">Navigate LEDs</p>
  868. <div class="grid grid-cols-2 gap-3">
  869. <button
  870. id="ledPrev1"
  871. class="flex items-center justify-center gap-2 h-12 px-4 rounded-lg border-2 border-slate-300 hover:border-sky-500 hover:bg-sky-50 dark:hover:bg-sky-900 text-slate-700 dark:text-slate-300 font-medium transition-all"
  872. >
  873. <span class="material-icons">chevron_left</span>
  874. <span>← 1 LED</span>
  875. </button>
  876. <button
  877. id="ledNext1"
  878. class="flex items-center justify-center gap-2 h-12 px-4 rounded-lg border-2 border-slate-300 hover:border-sky-500 hover:bg-sky-50 dark:hover:bg-sky-900 text-slate-700 dark:text-slate-300 font-medium transition-all"
  879. >
  880. <span>1 LED →</span>
  881. <span class="material-icons">chevron_right</span>
  882. </button>
  883. <button
  884. id="ledPrev5"
  885. class="flex items-center justify-center gap-2 h-12 px-4 rounded-lg border-2 border-slate-300 hover:border-sky-500 hover:bg-sky-50 dark:hover:bg-sky-900 text-slate-700 dark:text-slate-300 font-medium transition-all"
  886. >
  887. <span class="material-icons">fast_rewind</span>
  888. <span>← 5 LEDs</span>
  889. </button>
  890. <button
  891. id="ledNext5"
  892. class="flex items-center justify-center gap-2 h-12 px-4 rounded-lg border-2 border-slate-300 hover:border-sky-500 hover:bg-sky-50 dark:hover:bg-sky-900 text-slate-700 dark:text-slate-300 font-medium transition-all"
  893. >
  894. <span>5 LEDs →</span>
  895. <span class="material-icons">fast_forward</span>
  896. </button>
  897. </div>
  898. </div>
  899. <!-- Direction Reversal -->
  900. <div class="border-t border-slate-200 pt-4 mt-4">
  901. <div class="flex items-center justify-between p-3 bg-amber-50 border border-amber-200 rounded-lg">
  902. <div class="flex-1">
  903. <h5 class="text-sm font-medium text-slate-800">Reverse LED Direction</h5>
  904. <p class="text-xs text-slate-600 mt-1">
  905. Enable if your LED strip runs counter-clockwise
  906. </p>
  907. </div>
  908. <label class="switch">
  909. <input type="checkbox" id="reverseDirectionToggle">
  910. <span class="slider round"></span>
  911. </label>
  912. </div>
  913. </div>
  914. <!-- Confirm Button -->
  915. <button
  916. id="confirmCalibration"
  917. class="flex items-center justify-center gap-2 w-full h-12 px-4 rounded-lg bg-green-600 hover:bg-green-700 text-white text-base font-medium transition-colors mt-4"
  918. >
  919. <span class="material-icons">check_circle</span>
  920. <span>Confirm Calibration</span>
  921. </button>
  922. </div>
  923. <!-- Completion -->
  924. <div id="calibrationComplete" class="space-y-4 hidden text-center">
  925. <div class="flex justify-center">
  926. <div class="w-20 h-20 rounded-full bg-green-100 flex items-center justify-center">
  927. <span class="material-icons text-green-600 text-5xl">check_circle</span>
  928. </div>
  929. </div>
  930. <h4 class="text-lg font-medium text-slate-800">Calibration Complete!</h4>
  931. <p class="text-sm text-slate-600">
  932. LED alignment has been calibrated. Ball tracking is now ready to use.
  933. </p>
  934. <div class="bg-slate-50 rounded-lg p-4 text-left">
  935. <p class="text-xs text-slate-600">
  936. <strong>LED Offset:</strong> <span id="finalLedOffset"></span><br>
  937. <strong>Direction:</strong> <span id="finalDirection"></span>
  938. </p>
  939. </div>
  940. <button
  941. id="closeCalibrationComplete"
  942. class="flex items-center justify-center gap-2 w-full cursor-pointer rounded-lg h-12 px-4 bg-sky-600 hover:bg-sky-700 text-white text-base font-medium transition-colors"
  943. >
  944. <span>Done</span>
  945. </button>
  946. </div>
  947. </div>
  948. </div>
  949. </div>
  950. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  951. <h2
  952. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  953. >
  954. Auto-play on Boot
  955. </h2>
  956. <div class="px-6 py-5 space-y-6">
  957. <div class="flex items-center justify-between">
  958. <div class="flex-1">
  959. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Auto-play on Boot</h3>
  960. <p class="text-xs text-slate-500 mt-1">
  961. Automatically start playing a selected playlist when the system boots up.
  962. </p>
  963. </div>
  964. <label class="switch">
  965. <input type="checkbox" id="auto_playModeToggle">
  966. <span class="slider round"></span>
  967. </label>
  968. </div>
  969. <div id="auto_playSettings" class="space-y-4" style="display: none;">
  970. <label class="flex flex-col gap-1.5">
  971. <span class="text-slate-700 text-sm font-medium leading-normal">Startup Playlist</span>
  972. <select
  973. id="auto_playPlaylistSelect"
  974. class="form-select flex-1 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-medium leading-normal transition-colors"
  975. >
  976. <option value="">Select a playlist...</option>
  977. </select>
  978. <p class="text-xs text-slate-500 mt-1">
  979. Choose which playlist to automatically play when the system starts.
  980. </p>
  981. </label>
  982. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  983. <label class="flex flex-col gap-1.5">
  984. <span class="text-slate-700 text-sm font-medium leading-normal">Run Mode</span>
  985. <select
  986. id="auto_playRunModeSelect"
  987. class="form-select resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-medium leading-normal transition-colors"
  988. >
  989. <option value="single">Single (play once)</option>
  990. <option value="loop">Loop (repeat forever)</option>
  991. </select>
  992. <p class="text-xs text-slate-500 mt-1">
  993. How to run the playlist when it finishes.
  994. </p>
  995. </label>
  996. <label class="flex flex-col gap-1.5">
  997. <span class="text-slate-700 text-sm font-medium leading-normal">Pause Between Patterns (seconds)</span>
  998. <input
  999. id="auto_playPauseTimeInput"
  1000. type="number"
  1001. min="0"
  1002. step="0.5"
  1003. class="form-input resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-normal leading-normal transition-colors"
  1004. placeholder="5.0"
  1005. />
  1006. <p class="text-xs text-slate-500 mt-1">
  1007. Time to wait between each pattern (0 or more seconds).
  1008. </p>
  1009. </label>
  1010. </div>
  1011. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  1012. <label class="flex flex-col gap-1.5">
  1013. <span class="text-slate-700 text-sm font-medium leading-normal">Clear Pattern</span>
  1014. <select
  1015. id="auto_playClearPatternSelect"
  1016. class="form-select resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-medium leading-normal transition-colors"
  1017. >
  1018. <option value="none">None</option>
  1019. <option value="adaptive">Adaptive</option>
  1020. <option value="clear_from_in">Clear From Center</option>
  1021. <option value="clear_from_out">Clear From Perimeter</option>
  1022. <option value="clear_sideway">Clear Sideway</option>
  1023. <option value="random">Random</option>
  1024. </select>
  1025. <p class="text-xs text-slate-500 mt-1">
  1026. Pattern to run before each main pattern.
  1027. </p>
  1028. </label>
  1029. <div class="flex items-center justify-between">
  1030. <div class="flex-1">
  1031. <h4 class="text-slate-700 text-sm font-medium leading-normal">Shuffle Playlist</h4>
  1032. <p class="text-xs text-slate-500 mt-1">
  1033. Randomize the order of patterns in the playlist.
  1034. </p>
  1035. </div>
  1036. <label class="switch">
  1037. <input type="checkbox" id="auto_playShuffleToggle">
  1038. <span class="slider round"></span>
  1039. </label>
  1040. </div>
  1041. </div>
  1042. </div>
  1043. </div>
  1044. </section>
  1045. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  1046. <h2
  1047. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  1048. >
  1049. Still Sands
  1050. </h2>
  1051. <div class="px-6 py-5 space-y-6">
  1052. <div class="flex items-center justify-between">
  1053. <div class="flex-1">
  1054. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Still Sands</h3>
  1055. <p class="text-xs text-slate-500 mt-1">
  1056. Automatically bring the sands to rest during specified time periods.
  1057. </p>
  1058. </div>
  1059. <label class="switch">
  1060. <input type="checkbox" id="scheduledPauseToggle">
  1061. <span class="slider round"></span>
  1062. </label>
  1063. </div>
  1064. <div id="scheduledPauseSettings" class="space-y-4" style="display: none;">
  1065. <!-- WLED Control Option -->
  1066. <div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
  1067. <div class="flex items-center justify-between">
  1068. <div class="flex-1">
  1069. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  1070. <span class="material-icons text-amber-600 text-base">lightbulb</span>
  1071. Control WLED Lights
  1072. </h4>
  1073. <p class="text-xs text-slate-600 mt-1">
  1074. Turn off WLED lights during still periods for complete rest
  1075. </p>
  1076. </div>
  1077. <label class="switch">
  1078. <input type="checkbox" id="stillSandsWledControl">
  1079. <span class="slider round"></span>
  1080. </label>
  1081. </div>
  1082. </div>
  1083. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  1084. <div class="flex items-center justify-between">
  1085. <h4 class="text-slate-800 text-base font-semibold">Still Periods</h4>
  1086. <button
  1087. id="addTimeSlotButton"
  1088. class="flex items-center justify-center gap-2 cursor-pointer rounded-lg h-9 px-3 bg-sky-600 hover:bg-sky-700 text-white text-xs font-medium leading-normal tracking-[0.015em] transition-colors"
  1089. >
  1090. <span class="material-icons text-base">add</span>
  1091. <span>Add Still Period</span>
  1092. </button>
  1093. </div>
  1094. <p class="text-sm text-slate-600">
  1095. Define time periods when the sands should rest in stillness. Patterns will resume automatically when still periods end.
  1096. </p>
  1097. <div id="timeSlotsContainer" class="space-y-3">
  1098. <!-- Time slots will be dynamically added here -->
  1099. </div>
  1100. <div class="text-xs text-slate-500 bg-blue-50 border border-blue-200 rounded-lg p-3">
  1101. <div class="flex items-start gap-2">
  1102. <span class="material-icons text-blue-600 text-base">info</span>
  1103. <div>
  1104. <p class="font-medium text-blue-800">Important Notes:</p>
  1105. <ul class="mt-1 space-y-1 text-blue-700">
  1106. <li>• Times are based on your system's local time zone</li>
  1107. <li>• Currently running patterns will pause immediately when entering a still period</li>
  1108. <li>• Patterns will resume automatically when exiting a still period</li>
  1109. <li>• Still periods that span midnight (e.g., 22:00 to 06:00) are supported</li>
  1110. </ul>
  1111. </div>
  1112. </div>
  1113. </div>
  1114. </div>
  1115. <div class="flex justify-end">
  1116. <button
  1117. id="savePauseSettings"
  1118. class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  1119. >
  1120. <span class="material-icons text-lg">save</span>
  1121. <span class="truncate">Save Still Sands</span>
  1122. </button>
  1123. </div>
  1124. </div>
  1125. </div>
  1126. </section>
  1127. <section id="software-version-section" class="bg-white rounded-xl shadow-sm overflow-hidden">
  1128. <h2
  1129. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  1130. >
  1131. Software Version
  1132. </h2>
  1133. <div class="divide-y divide-slate-100">
  1134. <div class="flex items-center gap-4 px-6 py-5">
  1135. <div
  1136. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  1137. >
  1138. <span class="material-icons text-3xl">terminal</span>
  1139. </div>
  1140. <div class="flex-1">
  1141. <p class="text-slate-800 text-base font-medium leading-normal">
  1142. Current Version
  1143. </p>
  1144. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  1145. </div>
  1146. </div>
  1147. <div class="flex items-center gap-4 px-6 py-5">
  1148. <div
  1149. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  1150. >
  1151. <span class="material-icons text-3xl">system_update</span>
  1152. </div>
  1153. <div class="flex-1">
  1154. <p class="text-slate-800 text-base font-medium leading-normal">
  1155. Latest Version
  1156. </p>
  1157. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  1158. </div>
  1159. <button
  1160. id="updateSoftware"
  1161. class="flex items-center justify-center gap-1.5 min-w-[84px] cursor-pointer rounded-lg h-9 px-3 bg-gray-400 text-white text-xs font-medium leading-normal tracking-[0.015em] transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
  1162. disabled
  1163. >
  1164. <span id="updateIcon" class="material-icons text-base">download</span>
  1165. <span id="updateText" class="truncate">Update</span>
  1166. </button>
  1167. </div>
  1168. </div>
  1169. </section>
  1170. </div>
  1171. {% endblock %} {% block scripts %}
  1172. <script src="/static/js/settings.js"></script>
  1173. {% endblock %}