settings.html 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  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. <!-- Look-back Delay -->
  772. <label class="flex flex-col gap-1.5">
  773. <span class="text-slate-700 text-sm font-medium leading-normal">Look-back Delay</span>
  774. <input
  775. id="ballTrackingLookback"
  776. type="range"
  777. min="0"
  778. max="15"
  779. value="5"
  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="ballTrackingLookbackValue">5 coords</span>
  785. <span>15</span>
  786. </div>
  787. <p class="text-xs text-slate-500">
  788. Compensate for motion lag by tracking past position
  789. </p>
  790. </label>
  791. <!-- Brightness -->
  792. <label class="flex flex-col gap-1.5">
  793. <span class="text-slate-700 text-sm font-medium leading-normal">Brightness</span>
  794. <input
  795. id="ballTrackingBrightness"
  796. type="range"
  797. min="0"
  798. max="100"
  799. value="50"
  800. class="w-full h-2 bg-slate-200 rounded-lg appearance-none cursor-pointer"
  801. />
  802. <div class="flex justify-between text-xs text-slate-500">
  803. <span>0%</span>
  804. <span id="ballTrackingBrightnessValue">50%</span>
  805. <span>100%</span>
  806. </div>
  807. </label>
  808. <!-- Color Picker -->
  809. <label class="flex flex-col gap-1.5">
  810. <span class="text-slate-700 text-sm font-medium leading-normal">Tracking Color</span>
  811. <input
  812. id="ballTrackingColor"
  813. type="color"
  814. value="#ffffff"
  815. class="w-full h-10 rounded-lg cursor-pointer border border-slate-300"
  816. />
  817. <p class="text-xs text-slate-500">
  818. Color of tracking LEDs
  819. </p>
  820. </label>
  821. </div>
  822. <!-- Save Button -->
  823. <div class="flex justify-end">
  824. <button
  825. id="saveBallTrackingConfig"
  826. 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"
  827. >
  828. <span class="material-icons text-lg">save</span>
  829. <span class="truncate">Save Settings</span>
  830. </button>
  831. </div>
  832. </div>
  833. </div>
  834. </section>
  835. <!-- Calibration Wizard Modal -->
  836. <div id="calibrationModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center p-4">
  837. <div class="bg-white rounded-xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-y-auto">
  838. <!-- Modal Header -->
  839. <div class="flex items-center justify-between px-6 py-4 border-b border-slate-200">
  840. <h3 class="text-slate-900 text-xl font-semibold">Ball Tracking Calibration</h3>
  841. <button id="closeCalibrationModal" class="text-slate-400 hover:text-slate-600">
  842. <span class="material-icons">close</span>
  843. </button>
  844. </div>
  845. <!-- Modal Content -->
  846. <div class="px-6 py-6">
  847. <!-- Step Indicator -->
  848. <div class="flex items-center justify-between mb-6">
  849. <div class="flex items-center gap-2">
  850. <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>
  851. <div class="w-16 h-1 bg-slate-200" id="line1"></div>
  852. <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>
  853. <div class="w-16 h-1 bg-slate-200" id="line2"></div>
  854. <div id="step3Indicator" class="flex items-center justify-center w-8 h-8 rounded-full bg-slate-200 text-slate-500 text-sm font-medium">3</div>
  855. </div>
  856. </div>
  857. <!-- Step 1: Move to Reference -->
  858. <div id="calibrationStep1" class="space-y-4">
  859. <h4 class="text-lg font-medium text-slate-800">Step 1: Move to Reference Position</h4>
  860. <p class="text-sm text-slate-600">
  861. 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.
  862. </p>
  863. <button
  864. id="startCalibrationMove"
  865. 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"
  866. >
  867. <span class="material-icons text-xl">navigation</span>
  868. <span>Move Ball to Reference Position</span>
  869. </button>
  870. <div id="calibrationMoveStatus" class="hidden text-sm text-slate-600 text-center">
  871. <span class="inline-block animate-spin material-icons text-sky-600">refresh</span>
  872. Moving to reference position...
  873. </div>
  874. </div>
  875. <!-- Step 2: Identify LED -->
  876. <div id="calibrationStep2" class="space-y-4 hidden">
  877. <h4 class="text-lg font-medium text-slate-800">Step 2: Identify LED Position</h4>
  878. <p class="text-sm text-slate-600 mb-4">
  879. The ball is now at the 0° reference position (perimeter). Click on the LED that is at this position in the circular diagram below.
  880. </p>
  881. <!-- LED Circle Visualization -->
  882. <div class="flex justify-center my-6">
  883. <svg id="ledCircle" viewBox="0 0 400 400" class="w-full max-w-md">
  884. <!-- Circle representing LED strip -->
  885. <circle cx="200" cy="200" r="150" fill="none" stroke="#e2e8f0" stroke-width="2"/>
  886. <!-- 0° marker (East) -->
  887. <line x1="350" y1="200" x2="370" y2="200" stroke="#0c7ff2" stroke-width="3"/>
  888. <text x="380" y="205" fill="#0c7ff2" font-size="14" font-weight="bold">0°</text>
  889. <!-- LEDs will be added here by JavaScript -->
  890. </svg>
  891. </div>
  892. <p id="selectedLedInfo" class="text-sm text-center text-slate-600">
  893. No LED selected
  894. </p>
  895. </div>
  896. <!-- Step 3: Test Direction -->
  897. <div id="calibrationStep3" class="space-y-4 hidden">
  898. <h4 class="text-lg font-medium text-slate-800">Step 3: Test Direction</h4>
  899. <p class="text-sm text-slate-600 mb-4">
  900. We'll move the ball to 90° to test LED direction. Watch which way the LEDs move.
  901. </p>
  902. <button
  903. id="testDirection"
  904. 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"
  905. >
  906. <span class="material-icons text-xl">rotate_right</span>
  907. <span>Move to 90° and Test</span>
  908. </button>
  909. <div id="directionTestStatus" class="hidden text-sm text-slate-600 text-center">
  910. <span class="inline-block animate-spin material-icons text-sky-600">refresh</span>
  911. Testing direction...
  912. </div>
  913. <div id="directionQuestion" class="hidden space-y-4 mt-4">
  914. <p class="text-sm text-slate-700 font-medium text-center">Did the LED move clockwise?</p>
  915. <div class="grid grid-cols-2 gap-4">
  916. <button
  917. id="directionClockwise"
  918. class="flex items-center justify-center gap-2 cursor-pointer rounded-lg h-12 px-4 bg-green-600 hover:bg-green-700 text-white text-base font-medium transition-colors"
  919. >
  920. <span class="material-icons">check_circle</span>
  921. <span>Yes, Clockwise</span>
  922. </button>
  923. <button
  924. id="directionCounterClockwise"
  925. class="flex items-center justify-center gap-2 cursor-pointer rounded-lg h-12 px-4 bg-orange-600 hover:bg-orange-700 text-white text-base font-medium transition-colors"
  926. >
  927. <span class="material-icons">sync</span>
  928. <span>No, Reverse It</span>
  929. </button>
  930. </div>
  931. </div>
  932. </div>
  933. <!-- Completion -->
  934. <div id="calibrationComplete" class="space-y-4 hidden text-center">
  935. <div class="flex justify-center">
  936. <div class="w-20 h-20 rounded-full bg-green-100 flex items-center justify-center">
  937. <span class="material-icons text-green-600 text-5xl">check_circle</span>
  938. </div>
  939. </div>
  940. <h4 class="text-lg font-medium text-slate-800">Calibration Complete!</h4>
  941. <p class="text-sm text-slate-600">
  942. LED alignment has been calibrated. Ball tracking is now ready to use.
  943. </p>
  944. <div class="bg-slate-50 rounded-lg p-4 text-left">
  945. <p class="text-xs text-slate-600">
  946. <strong>LED Offset:</strong> <span id="finalLedOffset"></span><br>
  947. <strong>Direction:</strong> <span id="finalDirection"></span>
  948. </p>
  949. </div>
  950. <button
  951. id="closeCalibrationComplete"
  952. 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"
  953. >
  954. <span>Done</span>
  955. </button>
  956. </div>
  957. </div>
  958. </div>
  959. </div>
  960. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  961. <h2
  962. 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"
  963. >
  964. Auto-play on Boot
  965. </h2>
  966. <div class="px-6 py-5 space-y-6">
  967. <div class="flex items-center justify-between">
  968. <div class="flex-1">
  969. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Auto-play on Boot</h3>
  970. <p class="text-xs text-slate-500 mt-1">
  971. Automatically start playing a selected playlist when the system boots up.
  972. </p>
  973. </div>
  974. <label class="switch">
  975. <input type="checkbox" id="auto_playModeToggle">
  976. <span class="slider round"></span>
  977. </label>
  978. </div>
  979. <div id="auto_playSettings" class="space-y-4" style="display: none;">
  980. <label class="flex flex-col gap-1.5">
  981. <span class="text-slate-700 text-sm font-medium leading-normal">Startup Playlist</span>
  982. <select
  983. id="auto_playPlaylistSelect"
  984. 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"
  985. >
  986. <option value="">Select a playlist...</option>
  987. </select>
  988. <p class="text-xs text-slate-500 mt-1">
  989. Choose which playlist to automatically play when the system starts.
  990. </p>
  991. </label>
  992. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  993. <label class="flex flex-col gap-1.5">
  994. <span class="text-slate-700 text-sm font-medium leading-normal">Run Mode</span>
  995. <select
  996. id="auto_playRunModeSelect"
  997. 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"
  998. >
  999. <option value="single">Single (play once)</option>
  1000. <option value="loop">Loop (repeat forever)</option>
  1001. </select>
  1002. <p class="text-xs text-slate-500 mt-1">
  1003. How to run the playlist when it finishes.
  1004. </p>
  1005. </label>
  1006. <label class="flex flex-col gap-1.5">
  1007. <span class="text-slate-700 text-sm font-medium leading-normal">Pause Between Patterns (seconds)</span>
  1008. <input
  1009. id="auto_playPauseTimeInput"
  1010. type="number"
  1011. min="0"
  1012. step="0.5"
  1013. 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"
  1014. placeholder="5.0"
  1015. />
  1016. <p class="text-xs text-slate-500 mt-1">
  1017. Time to wait between each pattern (0 or more seconds).
  1018. </p>
  1019. </label>
  1020. </div>
  1021. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  1022. <label class="flex flex-col gap-1.5">
  1023. <span class="text-slate-700 text-sm font-medium leading-normal">Clear Pattern</span>
  1024. <select
  1025. id="auto_playClearPatternSelect"
  1026. 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"
  1027. >
  1028. <option value="none">None</option>
  1029. <option value="adaptive">Adaptive</option>
  1030. <option value="clear_from_in">Clear From Center</option>
  1031. <option value="clear_from_out">Clear From Perimeter</option>
  1032. <option value="clear_sideway">Clear Sideway</option>
  1033. <option value="random">Random</option>
  1034. </select>
  1035. <p class="text-xs text-slate-500 mt-1">
  1036. Pattern to run before each main pattern.
  1037. </p>
  1038. </label>
  1039. <div class="flex items-center justify-between">
  1040. <div class="flex-1">
  1041. <h4 class="text-slate-700 text-sm font-medium leading-normal">Shuffle Playlist</h4>
  1042. <p class="text-xs text-slate-500 mt-1">
  1043. Randomize the order of patterns in the playlist.
  1044. </p>
  1045. </div>
  1046. <label class="switch">
  1047. <input type="checkbox" id="auto_playShuffleToggle">
  1048. <span class="slider round"></span>
  1049. </label>
  1050. </div>
  1051. </div>
  1052. </div>
  1053. </div>
  1054. </section>
  1055. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  1056. <h2
  1057. 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"
  1058. >
  1059. Still Sands
  1060. </h2>
  1061. <div class="px-6 py-5 space-y-6">
  1062. <div class="flex items-center justify-between">
  1063. <div class="flex-1">
  1064. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Still Sands</h3>
  1065. <p class="text-xs text-slate-500 mt-1">
  1066. Automatically bring the sands to rest during specified time periods.
  1067. </p>
  1068. </div>
  1069. <label class="switch">
  1070. <input type="checkbox" id="scheduledPauseToggle">
  1071. <span class="slider round"></span>
  1072. </label>
  1073. </div>
  1074. <div id="scheduledPauseSettings" class="space-y-4" style="display: none;">
  1075. <!-- WLED Control Option -->
  1076. <div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
  1077. <div class="flex items-center justify-between">
  1078. <div class="flex-1">
  1079. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  1080. <span class="material-icons text-amber-600 text-base">lightbulb</span>
  1081. Control WLED Lights
  1082. </h4>
  1083. <p class="text-xs text-slate-600 mt-1">
  1084. Turn off WLED lights during still periods for complete rest
  1085. </p>
  1086. </div>
  1087. <label class="switch">
  1088. <input type="checkbox" id="stillSandsWledControl">
  1089. <span class="slider round"></span>
  1090. </label>
  1091. </div>
  1092. </div>
  1093. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  1094. <div class="flex items-center justify-between">
  1095. <h4 class="text-slate-800 text-base font-semibold">Still Periods</h4>
  1096. <button
  1097. id="addTimeSlotButton"
  1098. 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"
  1099. >
  1100. <span class="material-icons text-base">add</span>
  1101. <span>Add Still Period</span>
  1102. </button>
  1103. </div>
  1104. <p class="text-sm text-slate-600">
  1105. Define time periods when the sands should rest in stillness. Patterns will resume automatically when still periods end.
  1106. </p>
  1107. <div id="timeSlotsContainer" class="space-y-3">
  1108. <!-- Time slots will be dynamically added here -->
  1109. </div>
  1110. <div class="text-xs text-slate-500 bg-blue-50 border border-blue-200 rounded-lg p-3">
  1111. <div class="flex items-start gap-2">
  1112. <span class="material-icons text-blue-600 text-base">info</span>
  1113. <div>
  1114. <p class="font-medium text-blue-800">Important Notes:</p>
  1115. <ul class="mt-1 space-y-1 text-blue-700">
  1116. <li>• Times are based on your system's local time zone</li>
  1117. <li>• Currently running patterns will pause immediately when entering a still period</li>
  1118. <li>• Patterns will resume automatically when exiting a still period</li>
  1119. <li>• Still periods that span midnight (e.g., 22:00 to 06:00) are supported</li>
  1120. </ul>
  1121. </div>
  1122. </div>
  1123. </div>
  1124. </div>
  1125. <div class="flex justify-end">
  1126. <button
  1127. id="savePauseSettings"
  1128. 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"
  1129. >
  1130. <span class="material-icons text-lg">save</span>
  1131. <span class="truncate">Save Still Sands</span>
  1132. </button>
  1133. </div>
  1134. </div>
  1135. </div>
  1136. </section>
  1137. <section id="software-version-section" class="bg-white rounded-xl shadow-sm overflow-hidden">
  1138. <h2
  1139. 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"
  1140. >
  1141. Software Version
  1142. </h2>
  1143. <div class="divide-y divide-slate-100">
  1144. <div class="flex items-center gap-4 px-6 py-5">
  1145. <div
  1146. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  1147. >
  1148. <span class="material-icons text-3xl">terminal</span>
  1149. </div>
  1150. <div class="flex-1">
  1151. <p class="text-slate-800 text-base font-medium leading-normal">
  1152. Current Version
  1153. </p>
  1154. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  1155. </div>
  1156. </div>
  1157. <div class="flex items-center gap-4 px-6 py-5">
  1158. <div
  1159. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  1160. >
  1161. <span class="material-icons text-3xl">system_update</span>
  1162. </div>
  1163. <div class="flex-1">
  1164. <p class="text-slate-800 text-base font-medium leading-normal">
  1165. Latest Version
  1166. </p>
  1167. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  1168. </div>
  1169. <button
  1170. id="updateSoftware"
  1171. 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"
  1172. disabled
  1173. >
  1174. <span id="updateIcon" class="material-icons text-base">download</span>
  1175. <span id="updateText" class="truncate">Update</span>
  1176. </button>
  1177. </div>
  1178. </div>
  1179. </section>
  1180. </div>
  1181. {% endblock %} {% block scripts %}
  1182. <script src="/static/js/settings.js"></script>
  1183. {% endblock %}