settings.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999
  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. <!-- Auto-Home During Playlists -->
  390. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  391. <div class="flex items-center justify-between">
  392. <div class="flex-1">
  393. <h3 class="text-slate-800 text-base font-semibold flex items-center gap-2">
  394. <span class="material-icons text-slate-600 text-base">autorenew</span>
  395. Auto-Home During Playlists
  396. </h3>
  397. <p class="text-xs text-slate-500 mt-1">
  398. Automatically perform homing after a certain number of patterns during playlist playback to maintain accuracy.
  399. </p>
  400. </div>
  401. <label class="switch">
  402. <input type="checkbox" id="autoHomeEnabledToggle">
  403. <span class="slider round"></span>
  404. </label>
  405. </div>
  406. <div id="autoHomeSettings" style="display: none;">
  407. <label class="flex flex-col gap-1.5">
  408. <span class="text-slate-700 text-sm font-medium leading-normal">Home after every X patterns</span>
  409. <input
  410. type="number"
  411. id="autoHomeAfterPatternsInput"
  412. min="1"
  413. max="100"
  414. step="1"
  415. value="5"
  416. 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"
  417. placeholder="5"
  418. />
  419. <p class="text-xs text-slate-500">
  420. Homing will occur right after the clear pattern completes, before the next actual pattern begins.
  421. </p>
  422. </label>
  423. </div>
  424. </div>
  425. <div class="flex justify-end">
  426. <button
  427. id="saveHomingConfig"
  428. 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"
  429. >
  430. <span class="material-icons text-lg">save</span>
  431. <span class="truncate">Save Configuration</span>
  432. </button>
  433. </div>
  434. </div>
  435. </section>
  436. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  437. <h2
  438. 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"
  439. >
  440. Application Settings
  441. </h2>
  442. <div class="px-6 py-5 space-y-6">
  443. <label class="flex flex-col gap-1.5">
  444. <span class="text-slate-700 text-sm font-medium leading-normal"
  445. >Application Name</span
  446. >
  447. <div class="flex gap-3 items-center">
  448. <div class="relative flex-1">
  449. <input
  450. id="appNameInput"
  451. 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"
  452. placeholder="e.g., Dune Weaver"
  453. value="Dune Weaver"
  454. />
  455. <button
  456. type="button"
  457. onclick="document.getElementById('appNameInput').value='Dune Weaver';"
  458. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  459. aria-label="Reset to default"
  460. title="Reset to default"
  461. >
  462. <span class="material-icons">restart_alt</span>
  463. </button>
  464. </div>
  465. <button
  466. id="saveAppName"
  467. 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"
  468. >
  469. <span class="material-icons text-lg">save</span>
  470. <span class="truncate">Save Name</span>
  471. </button>
  472. </div>
  473. <p class="text-xs text-slate-500 mt-2">
  474. This name will appear in the browser tab and at the top of every page.
  475. </p>
  476. </label>
  477. </div>
  478. </section>
  479. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  480. <h2
  481. 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"
  482. >
  483. Pattern Clearing
  484. </h2>
  485. <div class="px-6 py-5 space-y-6">
  486. <p class="text-sm text-slate-600">
  487. Customize the clearing behavior used when transitioning between patterns. Set custom patterns and speed to control how sand is distributed.
  488. </p>
  489. <!-- Clearing Speed Section -->
  490. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  491. <h3 class="text-slate-800 text-base font-semibold">Clearing Speed</h3>
  492. <p class="text-sm text-slate-600">
  493. 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.
  494. </p>
  495. <div class="flex flex-col gap-1.5">
  496. <label for="clearPatternSpeedInput" class="text-slate-700 text-sm font-medium leading-normal">
  497. Speed (steps per minute)
  498. </label>
  499. <div class="flex gap-3 items-center">
  500. <input
  501. id="clearPatternSpeedInput"
  502. type="number"
  503. min="50"
  504. max="2000"
  505. step="50"
  506. 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"
  507. placeholder="Default (use pattern speed)"
  508. value=""
  509. />
  510. <button
  511. id="saveClearSpeed"
  512. 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"
  513. >
  514. <span class="material-icons text-lg">save</span>
  515. <span class="truncate">Save Speed</span>
  516. </button>
  517. </div>
  518. <div id="effectiveClearSpeed" class="text-xs text-slate-500 mt-1"></div>
  519. </div>
  520. </div>
  521. <!-- Custom Patterns Section -->
  522. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  523. <h3 class="text-slate-800 text-base font-semibold">Custom Clear Patterns</h3>
  524. <p class="text-sm text-slate-600">
  525. Choose specific patterns to use when clearing. Leave empty to use the default clearing behavior.
  526. </p>
  527. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  528. <div class="flex flex-col gap-1.5">
  529. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  530. <div class="relative">
  531. <input
  532. id="customClearFromInInput"
  533. type="text"
  534. 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"
  535. placeholder="Type to search patterns or leave empty for default"
  536. autocomplete="off"
  537. />
  538. <button
  539. type="button"
  540. id="clearFromInClear"
  541. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  542. aria-label="Clear selection"
  543. title="Clear selection"
  544. >
  545. <span class="material-icons text-xl">close</span>
  546. </button>
  547. <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>
  548. </div>
  549. <p class="text-xs text-slate-500 mt-1">
  550. Pattern to use when clearing from the center outward.
  551. </p>
  552. </div>
  553. <div class="flex flex-col gap-1.5">
  554. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  555. <div class="relative">
  556. <input
  557. id="customClearFromOutInput"
  558. type="text"
  559. 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"
  560. placeholder="Type to search patterns or leave empty for default"
  561. autocomplete="off"
  562. />
  563. <button
  564. type="button"
  565. id="clearFromOutClear"
  566. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  567. aria-label="Clear selection"
  568. title="Clear selection"
  569. >
  570. <span class="material-icons text-xl">close</span>
  571. </button>
  572. <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>
  573. </div>
  574. <p class="text-xs text-slate-500 mt-1">
  575. Pattern to use when clearing from the perimeter inward.
  576. </p>
  577. </div>
  578. </div>
  579. <div class="flex justify-end">
  580. <button
  581. id="saveClearPatterns"
  582. 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"
  583. >
  584. <span class="material-icons text-lg">save</span>
  585. <span class="truncate">Save Patterns</span>
  586. </button>
  587. </div>
  588. </div>
  589. </div>
  590. </section>
  591. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  592. <h2
  593. 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"
  594. >
  595. LED Controller Configuration
  596. </h2>
  597. <div class="px-6 py-5 space-y-6">
  598. <!-- LED Provider Selection -->
  599. <div class="flex flex-col gap-2">
  600. <span class="text-slate-700 text-sm font-medium leading-normal">LED Provider</span>
  601. <div class="flex gap-3">
  602. <label class="flex items-center gap-2 cursor-pointer">
  603. <input type="radio" name="ledProvider" value="none" id="ledProviderNone" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  604. <span class="text-sm text-slate-700">None</span>
  605. </label>
  606. <label class="flex items-center gap-2 cursor-pointer">
  607. <input type="radio" name="ledProvider" value="wled" id="ledProviderWled" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  608. <span class="text-sm text-slate-700">WLED</span>
  609. </label>
  610. <label class="flex items-center gap-2 cursor-pointer">
  611. <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">
  612. <span class="text-sm text-slate-700">DW LEDs (Local GPIO)</span>
  613. </label>
  614. </div>
  615. <p class="text-xs text-slate-500">
  616. Select your LED control system (settings are mutually exclusive)
  617. </p>
  618. </div>
  619. <!-- WLED Configuration (shown when WLED is selected) -->
  620. <div id="wledConfig" class="flex flex-col gap-4 hidden">
  621. <label class="flex flex-col gap-1.5">
  622. <span class="text-slate-700 text-sm font-medium leading-normal">WLED IP Address</span>
  623. <div class="relative flex-1">
  624. <input
  625. id="wledIpInput"
  626. 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"
  627. placeholder="e.g., 192.168.1.100"
  628. value=""
  629. />
  630. <button
  631. type="button"
  632. onclick="document.getElementById('wledIpInput').value='';"
  633. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  634. aria-label="Clear WLED IP"
  635. >
  636. <span class="material-icons">close</span>
  637. </button>
  638. </div>
  639. <p class="text-xs text-slate-500">
  640. Enter the IP address of your WLED controller
  641. </p>
  642. </label>
  643. </div>
  644. <!-- DW LEDs Configuration (shown when DW LEDs is selected) -->
  645. <div id="dwLedsConfig" class="flex flex-col gap-4 hidden">
  646. <div class="bg-blue-50 border border-blue-200 rounded-lg p-3">
  647. <div class="flex items-start gap-2">
  648. <span class="material-icons text-blue-600 text-base">info</span>
  649. <div class="text-xs text-blue-700">
  650. <p class="font-medium text-blue-800">Supported LED Strips</p>
  651. <p class="mt-1"><strong>RGB (3-channel):</strong> WS2811, WS2812, WS2812B, WS2813, WS2815 and other WS281x strips.</p>
  652. <p class="mt-1"><strong>RGBW (4-channel):</strong> SK6812, SK6812W and other RGBW strips with dedicated white channel.</p>
  653. </div>
  654. </div>
  655. </div>
  656. <label class="flex flex-col gap-1.5">
  657. <span class="text-slate-700 text-sm font-medium leading-normal">Number of LEDs</span>
  658. <input
  659. id="dwLedNumLeds"
  660. type="number"
  661. 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"
  662. placeholder="60"
  663. value="60"
  664. min="1"
  665. max="1000"
  666. />
  667. <p class="text-xs text-slate-500">
  668. Total number of LEDs in your WS281x strip
  669. </p>
  670. </label>
  671. <label class="flex flex-col gap-1.5">
  672. <span class="text-slate-700 text-sm font-medium leading-normal">GPIO Pin</span>
  673. <select
  674. id="dwLedGpioPin"
  675. 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"
  676. >
  677. <option value="12">GPIO 12 (PWM0)</option>
  678. <option value="13">GPIO 13 (PWM1)</option>
  679. <option value="18">GPIO 18 (PWM0)</option>
  680. <option value="19">GPIO 19 (PWM1)</option>
  681. </select>
  682. <p class="text-xs text-slate-500">
  683. Select a PWM-capable GPIO pin for WS281x timing
  684. </p>
  685. </label>
  686. <label class="flex flex-col gap-1.5">
  687. <span class="text-slate-700 text-sm font-medium leading-normal">Pixel Color Order</span>
  688. <select
  689. id="dwLedPixelOrder"
  690. 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"
  691. >
  692. <optgroup label="RGB Strips (3-channel)">
  693. <option value="GRB" selected>GRB - WS2812/WS2812B (most common)</option>
  694. <option value="RGB">RGB - WS2815/WS2811 and some variants</option>
  695. <option value="BGR">BGR - Some WS2811 variants</option>
  696. <option value="RBG">RBG - Rare variant</option>
  697. <option value="GBR">GBR - Rare variant</option>
  698. <option value="BRG">BRG - Rare variant</option>
  699. </optgroup>
  700. <optgroup label="RGBW Strips (4-channel)">
  701. <option value="GRBW">GRBW - SK6812 RGBW (most common)</option>
  702. <option value="RGBW">RGBW - SK6812 RGBW variant</option>
  703. </optgroup>
  704. </select>
  705. <p class="text-xs text-slate-500">
  706. Most WS2812B strips use GRB. SK6812 RGBW strips typically use GRBW. If colors appear wrong, try different orders.
  707. </p>
  708. </label>
  709. </div>
  710. <!-- Save Button -->
  711. <button
  712. id="saveLedConfig"
  713. 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"
  714. >
  715. <span class="material-icons text-lg">save</span>
  716. <span class="truncate">Save LED Configuration</span>
  717. </button>
  718. </div>
  719. </section>
  720. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  721. <h2
  722. 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"
  723. >
  724. Auto-play on Boot
  725. </h2>
  726. <div class="px-6 py-5 space-y-6">
  727. <div class="flex items-center justify-between">
  728. <div class="flex-1">
  729. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Auto-play on Boot</h3>
  730. <p class="text-xs text-slate-500 mt-1">
  731. Automatically start playing a selected playlist when the system boots up.
  732. </p>
  733. </div>
  734. <label class="switch">
  735. <input type="checkbox" id="auto_playModeToggle">
  736. <span class="slider round"></span>
  737. </label>
  738. </div>
  739. <div id="auto_playSettings" class="space-y-4" style="display: none;">
  740. <label class="flex flex-col gap-1.5">
  741. <span class="text-slate-700 text-sm font-medium leading-normal">Startup Playlist</span>
  742. <select
  743. id="auto_playPlaylistSelect"
  744. 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"
  745. >
  746. <option value="">Select a playlist...</option>
  747. </select>
  748. <p class="text-xs text-slate-500 mt-1">
  749. Choose which playlist to automatically play when the system starts.
  750. </p>
  751. </label>
  752. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  753. <label class="flex flex-col gap-1.5">
  754. <span class="text-slate-700 text-sm font-medium leading-normal">Run Mode</span>
  755. <select
  756. id="auto_playRunModeSelect"
  757. 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"
  758. >
  759. <option value="single">Single (play once)</option>
  760. <option value="loop">Loop (repeat forever)</option>
  761. </select>
  762. <p class="text-xs text-slate-500 mt-1">
  763. How to run the playlist when it finishes.
  764. </p>
  765. </label>
  766. <label class="flex flex-col gap-1.5">
  767. <span class="text-slate-700 text-sm font-medium leading-normal">Pause Between Patterns (seconds)</span>
  768. <input
  769. id="auto_playPauseTimeInput"
  770. type="number"
  771. min="0"
  772. step="0.5"
  773. 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"
  774. placeholder="5.0"
  775. />
  776. <p class="text-xs text-slate-500 mt-1">
  777. Time to wait between each pattern (0 or more seconds).
  778. </p>
  779. </label>
  780. </div>
  781. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  782. <label class="flex flex-col gap-1.5">
  783. <span class="text-slate-700 text-sm font-medium leading-normal">Clear Pattern</span>
  784. <select
  785. id="auto_playClearPatternSelect"
  786. 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"
  787. >
  788. <option value="none">None</option>
  789. <option value="adaptive">Adaptive</option>
  790. <option value="clear_from_in">Clear From Center</option>
  791. <option value="clear_from_out">Clear From Perimeter</option>
  792. <option value="clear_sideway">Clear Sideway</option>
  793. <option value="random">Random</option>
  794. </select>
  795. <p class="text-xs text-slate-500 mt-1">
  796. Pattern to run before each main pattern.
  797. </p>
  798. </label>
  799. <div class="flex items-center justify-between">
  800. <div class="flex-1">
  801. <h4 class="text-slate-700 text-sm font-medium leading-normal">Shuffle Playlist</h4>
  802. <p class="text-xs text-slate-500 mt-1">
  803. Randomize the order of patterns in the playlist.
  804. </p>
  805. </div>
  806. <label class="switch">
  807. <input type="checkbox" id="auto_playShuffleToggle">
  808. <span class="slider round"></span>
  809. </label>
  810. </div>
  811. </div>
  812. </div>
  813. </div>
  814. </section>
  815. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  816. <h2
  817. 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"
  818. >
  819. Still Sands
  820. </h2>
  821. <div class="px-6 py-5 space-y-6">
  822. <div class="flex items-center justify-between">
  823. <div class="flex-1">
  824. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Still Sands</h3>
  825. <p class="text-xs text-slate-500 mt-1">
  826. Automatically bring the sands to rest during specified time periods.
  827. </p>
  828. </div>
  829. <label class="switch">
  830. <input type="checkbox" id="scheduledPauseToggle">
  831. <span class="slider round"></span>
  832. </label>
  833. </div>
  834. <div id="scheduledPauseSettings" class="space-y-4" style="display: none;">
  835. <!-- WLED Control Option -->
  836. <div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
  837. <div class="flex items-center justify-between">
  838. <div class="flex-1">
  839. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  840. <span class="material-icons text-amber-600 text-base">lightbulb</span>
  841. Control WLED Lights
  842. </h4>
  843. <p class="text-xs text-slate-600 mt-1">
  844. Turn off WLED lights during still periods for complete rest
  845. </p>
  846. </div>
  847. <label class="switch">
  848. <input type="checkbox" id="stillSandsWledControl">
  849. <span class="slider round"></span>
  850. </label>
  851. </div>
  852. </div>
  853. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  854. <div class="flex items-center justify-between">
  855. <h4 class="text-slate-800 text-base font-semibold">Still Periods</h4>
  856. <button
  857. id="addTimeSlotButton"
  858. 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"
  859. >
  860. <span class="material-icons text-base">add</span>
  861. <span>Add Still Period</span>
  862. </button>
  863. </div>
  864. <p class="text-sm text-slate-600">
  865. Define time periods when the sands should rest in stillness. Patterns will resume automatically when still periods end.
  866. </p>
  867. <div id="timeSlotsContainer" class="space-y-3">
  868. <!-- Time slots will be dynamically added here -->
  869. </div>
  870. <div class="text-xs text-slate-500 bg-blue-50 border border-blue-200 rounded-lg p-3">
  871. <div class="flex items-start gap-2">
  872. <span class="material-icons text-blue-600 text-base">info</span>
  873. <div>
  874. <p class="font-medium text-blue-800">Important Notes:</p>
  875. <ul class="mt-1 space-y-1 text-blue-700">
  876. <li>• Times are based on your system's local time zone</li>
  877. <li>• Currently running patterns will pause immediately when entering a still period</li>
  878. <li>• Patterns will resume automatically when exiting a still period</li>
  879. <li>• Still periods that span midnight (e.g., 22:00 to 06:00) are supported</li>
  880. </ul>
  881. </div>
  882. </div>
  883. </div>
  884. </div>
  885. <div class="flex justify-end">
  886. <button
  887. id="savePauseSettings"
  888. 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"
  889. >
  890. <span class="material-icons text-lg">save</span>
  891. <span class="truncate">Save Still Sands</span>
  892. </button>
  893. </div>
  894. </div>
  895. </div>
  896. </section>
  897. <section id="software-version-section" class="bg-white rounded-xl shadow-sm overflow-hidden">
  898. <h2
  899. 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"
  900. >
  901. Software Version
  902. </h2>
  903. <div class="divide-y divide-slate-100">
  904. <div class="flex items-center gap-4 px-6 py-5">
  905. <div
  906. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  907. >
  908. <span class="material-icons text-3xl">terminal</span>
  909. </div>
  910. <div class="flex-1">
  911. <p class="text-slate-800 text-base font-medium leading-normal">
  912. Current Version
  913. </p>
  914. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  915. </div>
  916. </div>
  917. <div class="flex items-center gap-4 px-6 py-5">
  918. <div
  919. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  920. >
  921. <span class="material-icons text-3xl">system_update</span>
  922. </div>
  923. <div class="flex-1">
  924. <p class="text-slate-800 text-base font-medium leading-normal">
  925. Latest Version
  926. </p>
  927. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  928. </div>
  929. <button
  930. id="updateSoftware"
  931. 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"
  932. disabled
  933. >
  934. <span id="updateIcon" class="material-icons text-base">download</span>
  935. <span id="updateText" class="truncate">Update</span>
  936. </button>
  937. </div>
  938. </div>
  939. </section>
  940. </div>
  941. {% endblock %} {% block scripts %}
  942. <script src="/static/js/settings.js"></script>
  943. {% endblock %}