1
0

settings.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  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. background-color: #1f1f1f;
  49. border-color: #404040;
  50. color: #e5e5e5;
  51. }
  52. .dark .form-input::placeholder {
  53. color: #9ca3af;
  54. }
  55. .dark .form-input:focus {
  56. border-color: #0c7ff2;
  57. ring-color: #0c7ff2;
  58. }
  59. .dark .form-select {
  60. background-color: #1f1f1f;
  61. border-color: #404040;
  62. color: #e5e5e5;
  63. }
  64. .dark .form-select:focus {
  65. border-color: #0c7ff2;
  66. ring-color: #0c7ff2;
  67. }
  68. .dark .focus\:ring-sky-500:focus {
  69. ring-color: #0c7ff2;
  70. }
  71. .dark .focus\:border-sky-500:focus {
  72. border-color: #0c7ff2;
  73. }
  74. .dark .hover\:text-gray-700:hover {
  75. color: #e5e5e5;
  76. }
  77. .dark .text-gray-400 {
  78. color: #9ca3af;
  79. }
  80. /* Autocomplete suggestions dark mode */
  81. .dark #clearFromInSuggestions,
  82. .dark #clearFromOutSuggestions {
  83. background-color: #262626;
  84. border-color: #404040;
  85. }
  86. .dark .suggestion-item {
  87. color: #e5e5e5;
  88. }
  89. .dark .suggestion-item:hover {
  90. background-color: #404040;
  91. }
  92. .dark .suggestion-item.selected {
  93. background-color: #0c7ff2;
  94. color: white;
  95. }
  96. /* Light mode autocomplete styles */
  97. .suggestion-item {
  98. padding: 8px 12px;
  99. cursor: pointer;
  100. color: #1f2937;
  101. transition: background-color 0.15s;
  102. }
  103. .suggestion-item:hover {
  104. background-color: #f3f4f6;
  105. }
  106. .suggestion-item.selected {
  107. background-color: #0c7ff2;
  108. color: white;
  109. }
  110. .suggestion-item mark {
  111. background-color: #fef3c7;
  112. font-weight: 600;
  113. }
  114. .dark .suggestion-item mark {
  115. background-color: #92400e;
  116. color: #fef3c7;
  117. }
  118. /* Toggle switch styles */
  119. .switch {
  120. position: relative;
  121. display: inline-block;
  122. width: 60px;
  123. height: 34px;
  124. }
  125. .switch input {
  126. opacity: 0;
  127. width: 0;
  128. height: 0;
  129. }
  130. .slider {
  131. position: absolute;
  132. cursor: pointer;
  133. top: 0;
  134. left: 0;
  135. right: 0;
  136. bottom: 0;
  137. background-color: #ccc;
  138. transition: .4s;
  139. }
  140. .slider:before {
  141. position: absolute;
  142. content: "";
  143. height: 26px;
  144. width: 26px;
  145. left: 4px;
  146. bottom: 4px;
  147. background-color: white;
  148. transition: .4s;
  149. }
  150. input:checked + .slider {
  151. background-color: #0c7ff2;
  152. }
  153. input:focus + .slider {
  154. box-shadow: 0 0 1px #0c7ff2;
  155. }
  156. input:checked + .slider:before {
  157. transform: translateX(26px);
  158. }
  159. .slider.round {
  160. border-radius: 34px;
  161. }
  162. .slider.round:before {
  163. border-radius: 50%;
  164. }
  165. /* Dark mode for switches */
  166. .dark .slider {
  167. background-color: #404040;
  168. }
  169. .dark input:checked + .slider {
  170. background-color: #0c7ff2;
  171. }
  172. /* Spin animation for loading states */
  173. @keyframes spin {
  174. from {
  175. transform: rotate(0deg);
  176. }
  177. to {
  178. transform: rotate(360deg);
  179. }
  180. }
  181. .animate-spin {
  182. animation: spin 1s linear infinite;
  183. }
  184. /* Time slot specific styles */
  185. .time-slot-item {
  186. background-color: #f8fafc;
  187. border: 1px solid #e2e8f0;
  188. border-radius: 8px;
  189. padding: 16px;
  190. transition: all 0.15s;
  191. }
  192. .dark .time-slot-item {
  193. background-color: #1e293b;
  194. border-color: #475569;
  195. }
  196. .time-slot-item:hover {
  197. border-color: #cbd5e1;
  198. }
  199. .dark .time-slot-item:hover {
  200. border-color: #64748b;
  201. }
  202. /* Info box dark mode - grey theme */
  203. .dark .bg-blue-50 {
  204. background-color: #1f1f1f;
  205. }
  206. .dark .border-blue-200 {
  207. border-color: #404040;
  208. }
  209. .dark .text-blue-600 {
  210. color: #e2e8f0;
  211. }
  212. .dark .text-blue-800 {
  213. color: #f1f5f9;
  214. }
  215. .dark .text-blue-700 {
  216. color: #e2e8f0;
  217. }
  218. /* Amber box dark mode - grey theme */
  219. .dark .bg-amber-50 {
  220. background-color: #1f1f1f;
  221. }
  222. .dark .border-amber-200 {
  223. border-color: #404040;
  224. }
  225. .dark .text-amber-600 {
  226. color: #f1f5f9;
  227. }
  228. {% endblock %}
  229. {% block content %}
  230. <div class="layout-content-container flex flex-col w-full max-w-4xl gap-8 pt-2 pb-[75px]">
  231. <div
  232. class="flex flex-wrap justify-between items-center p-4 bg-white rounded-xl shadow-sm mt-2 sm:mt-8"
  233. >
  234. <h1
  235. class="text-slate-900 tracking-tight text-2xl sm:text-3xl font-bold leading-tight"
  236. >
  237. Settings
  238. </h1>
  239. </div>
  240. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  241. <h2
  242. 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"
  243. >
  244. Device Connection
  245. </h2>
  246. <div class="divide-y divide-slate-100">
  247. <div
  248. class="flex items-center gap-4 px-6 py-5 hover:bg-slate-50 transition-colors"
  249. >
  250. <div
  251. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  252. >
  253. <span class="material-icons text-3xl">usb_off</span>
  254. </div>
  255. <div class="flex-1">
  256. <p class="text-slate-800 text-base font-medium leading-normal">
  257. Status
  258. </p>
  259. <p
  260. id="serialStatus"
  261. class="text-red-500 text-sm font-medium leading-normal"
  262. >
  263. Disconnected
  264. </p>
  265. </div>
  266. <button
  267. id="disconnectButton"
  268. 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"
  269. hidden
  270. >
  271. Disconnect
  272. </button>
  273. </div>
  274. <div id="portSelectionDiv" class="px-6 py-5 space-y-4">
  275. <label class="flex flex-col gap-1.5">
  276. <span class="text-slate-700 text-sm font-medium leading-normal"
  277. >Available Serial Ports</span
  278. >
  279. <div class="flex gap-3 items-center">
  280. <select
  281. id="portSelect"
  282. 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 "
  283. >
  284. <option value="">Select a port...</option>
  285. </select>
  286. <button
  287. id="connectButton"
  288. 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"
  289. >
  290. <span class="material-icons text-lg">cable</span>
  291. <span class="truncate">Connect</span>
  292. </button>
  293. </div>
  294. <p class="text-xs text-slate-500 mt-2">
  295. Select a port and click 'Connect' to establish a connection.
  296. </p>
  297. </label>
  298. </div>
  299. </div>
  300. </section>
  301. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  302. <h2
  303. 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"
  304. >
  305. Application Settings
  306. </h2>
  307. <div class="px-6 py-5 space-y-6">
  308. <label class="flex flex-col gap-1.5">
  309. <span class="text-slate-700 text-sm font-medium leading-normal"
  310. >Application Name</span
  311. >
  312. <div class="flex gap-3 items-center">
  313. <div class="relative flex-1">
  314. <input
  315. id="appNameInput"
  316. 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"
  317. placeholder="e.g., Dune Weaver"
  318. value="Dune Weaver"
  319. />
  320. <button
  321. type="button"
  322. onclick="document.getElementById('appNameInput').value='Dune Weaver';"
  323. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  324. aria-label="Reset to default"
  325. title="Reset to default"
  326. >
  327. <span class="material-icons">restart_alt</span>
  328. </button>
  329. </div>
  330. <button
  331. id="saveAppName"
  332. 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"
  333. >
  334. <span class="material-icons text-lg">save</span>
  335. <span class="truncate">Save Name</span>
  336. </button>
  337. </div>
  338. <p class="text-xs text-slate-500 mt-2">
  339. This name will appear in the browser tab and at the top of every page.
  340. </p>
  341. </label>
  342. </div>
  343. </section>
  344. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  345. <h2
  346. 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"
  347. >
  348. Pattern Clearing
  349. </h2>
  350. <div class="px-6 py-5 space-y-6">
  351. <p class="text-sm text-slate-600">
  352. Customize the clearing behavior used when transitioning between patterns. Set custom patterns and speed to control how sand is distributed.
  353. </p>
  354. <!-- Clearing Speed Section -->
  355. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  356. <h3 class="text-slate-800 text-base font-semibold">Clearing Speed</h3>
  357. <p class="text-sm text-slate-600">
  358. 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.
  359. </p>
  360. <div class="flex flex-col gap-1.5">
  361. <label for="clearPatternSpeedInput" class="text-slate-700 text-sm font-medium leading-normal">
  362. Speed (steps per minute)
  363. </label>
  364. <div class="flex gap-3 items-center">
  365. <input
  366. id="clearPatternSpeedInput"
  367. type="number"
  368. min="50"
  369. max="2000"
  370. step="50"
  371. 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"
  372. placeholder="Default (use pattern speed)"
  373. value=""
  374. />
  375. <button
  376. id="saveClearSpeed"
  377. 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"
  378. >
  379. <span class="material-icons text-lg">save</span>
  380. <span class="truncate">Save Speed</span>
  381. </button>
  382. </div>
  383. <div id="effectiveClearSpeed" class="text-xs text-slate-500 mt-1"></div>
  384. </div>
  385. </div>
  386. <!-- Custom Patterns Section -->
  387. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  388. <h3 class="text-slate-800 text-base font-semibold">Custom Clear Patterns</h3>
  389. <p class="text-sm text-slate-600">
  390. Choose specific patterns to use when clearing. Leave empty to use the default clearing behavior.
  391. </p>
  392. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  393. <div class="flex flex-col gap-1.5">
  394. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  395. <div class="relative">
  396. <input
  397. id="customClearFromInInput"
  398. type="text"
  399. 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"
  400. placeholder="Type to search patterns or leave empty for default"
  401. autocomplete="off"
  402. />
  403. <button
  404. type="button"
  405. id="clearFromInClear"
  406. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  407. aria-label="Clear selection"
  408. title="Clear selection"
  409. >
  410. <span class="material-icons text-xl">close</span>
  411. </button>
  412. <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>
  413. </div>
  414. <p class="text-xs text-slate-500 mt-1">
  415. Pattern to use when clearing from the center outward.
  416. </p>
  417. </div>
  418. <div class="flex flex-col gap-1.5">
  419. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  420. <div class="relative">
  421. <input
  422. id="customClearFromOutInput"
  423. type="text"
  424. 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"
  425. placeholder="Type to search patterns or leave empty for default"
  426. autocomplete="off"
  427. />
  428. <button
  429. type="button"
  430. id="clearFromOutClear"
  431. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  432. aria-label="Clear selection"
  433. title="Clear selection"
  434. >
  435. <span class="material-icons text-xl">close</span>
  436. </button>
  437. <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>
  438. </div>
  439. <p class="text-xs text-slate-500 mt-1">
  440. Pattern to use when clearing from the perimeter inward.
  441. </p>
  442. </div>
  443. </div>
  444. <div class="flex justify-end">
  445. <button
  446. id="saveClearPatterns"
  447. 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"
  448. >
  449. <span class="material-icons text-lg">save</span>
  450. <span class="truncate">Save Patterns</span>
  451. </button>
  452. </div>
  453. </div>
  454. </div>
  455. </section>
  456. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  457. <h2
  458. 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"
  459. >
  460. LED Controller Configuration
  461. </h2>
  462. <div class="px-6 py-5 space-y-6">
  463. <!-- LED Provider Selection -->
  464. <div class="flex flex-col gap-2">
  465. <span class="text-slate-700 text-sm font-medium leading-normal">LED Provider</span>
  466. <div class="flex gap-3">
  467. <label class="flex items-center gap-2 cursor-pointer">
  468. <input type="radio" name="ledProvider" value="none" id="ledProviderNone" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  469. <span class="text-sm text-slate-700">None</span>
  470. </label>
  471. <label class="flex items-center gap-2 cursor-pointer">
  472. <input type="radio" name="ledProvider" value="wled" id="ledProviderWled" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  473. <span class="text-sm text-slate-700">WLED</span>
  474. </label>
  475. <label class="flex items-center gap-2 cursor-pointer">
  476. <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">
  477. <span class="text-sm text-slate-700">DW LEDs (Local GPIO)</span>
  478. </label>
  479. </div>
  480. <p class="text-xs text-slate-500">
  481. Select your LED control system (settings are mutually exclusive)
  482. </p>
  483. </div>
  484. <!-- WLED Configuration (shown when WLED is selected) -->
  485. <div id="wledConfig" class="flex flex-col gap-4 hidden">
  486. <label class="flex flex-col gap-1.5">
  487. <span class="text-slate-700 text-sm font-medium leading-normal">WLED IP Address</span>
  488. <div class="relative flex-1">
  489. <input
  490. id="wledIpInput"
  491. 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"
  492. placeholder="e.g., 192.168.1.100"
  493. value=""
  494. />
  495. <button
  496. type="button"
  497. onclick="document.getElementById('wledIpInput').value='';"
  498. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  499. aria-label="Clear WLED IP"
  500. >
  501. <span class="material-icons">close</span>
  502. </button>
  503. </div>
  504. <p class="text-xs text-slate-500">
  505. Enter the IP address of your WLED controller
  506. </p>
  507. </label>
  508. </div>
  509. <!-- DW LEDs Configuration (shown when DW LEDs is selected) -->
  510. <div id="dwLedsConfig" class="flex flex-col gap-4 hidden">
  511. <div class="bg-blue-50 border border-blue-200 rounded-lg p-3">
  512. <div class="flex items-start gap-2">
  513. <span class="material-icons text-blue-600 text-base">info</span>
  514. <div class="text-xs text-blue-700">
  515. <p class="font-medium text-blue-800">Supported LED Strips: WS281x Only</p>
  516. <p class="mt-1">Compatible with WS2811, WS2812, WS2812B, WS2813, WS2815 (12V), and other WS281x RGB LED strips. RGBW strips (SK6812, SK6812W) are not supported.</p>
  517. </div>
  518. </div>
  519. </div>
  520. <label class="flex flex-col gap-1.5">
  521. <span class="text-slate-700 text-sm font-medium leading-normal">Number of LEDs</span>
  522. <input
  523. id="dwLedNumLeds"
  524. type="number"
  525. 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"
  526. placeholder="60"
  527. value="60"
  528. min="1"
  529. max="1000"
  530. />
  531. <p class="text-xs text-slate-500">
  532. Total number of LEDs in your WS281x strip
  533. </p>
  534. </label>
  535. <label class="flex flex-col gap-1.5">
  536. <span class="text-slate-700 text-sm font-medium leading-normal">GPIO Pin</span>
  537. <select
  538. id="dwLedGpioPin"
  539. 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"
  540. >
  541. <option value="12">GPIO 12 (PWM0)</option>
  542. <option value="13">GPIO 13 (PWM1)</option>
  543. <option value="18">GPIO 18 (PWM0)</option>
  544. <option value="19">GPIO 19 (PWM1)</option>
  545. </select>
  546. <p class="text-xs text-slate-500">
  547. Select a PWM-capable GPIO pin for WS281x timing
  548. </p>
  549. </label>
  550. <label class="flex flex-col gap-1.5">
  551. <span class="text-slate-700 text-sm font-medium leading-normal">Pixel Color Order (WS281x)</span>
  552. <select
  553. id="dwLedPixelOrder"
  554. 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"
  555. >
  556. <option value="GRB" selected>GRB - WS2812/WS2812B (most common)</option>
  557. <option value="RGB">RGB - WS2815/WS2811 and some variants</option>
  558. <option value="BGR">BGR - Some WS2811 variants</option>
  559. <option value="RBG">RBG - Rare variant</option>
  560. <option value="GBR">GBR - Rare variant</option>
  561. <option value="BRG">BRG - Rare variant</option>
  562. </select>
  563. <p class="text-xs text-slate-500">
  564. Most WS2812B and WS2815 strips use GRB. WS2811 often uses RGB. If colors appear wrong, try different orders.
  565. </p>
  566. </label>
  567. </div>
  568. <!-- Save Button -->
  569. <button
  570. id="saveLedConfig"
  571. 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"
  572. >
  573. <span class="material-icons text-lg">save</span>
  574. <span class="truncate">Save LED Configuration</span>
  575. </button>
  576. </div>
  577. </section>
  578. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  579. <h2
  580. 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"
  581. >
  582. Auto-play on Boot
  583. </h2>
  584. <div class="px-6 py-5 space-y-6">
  585. <div class="flex items-center justify-between">
  586. <div class="flex-1">
  587. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Auto-play on Boot</h3>
  588. <p class="text-xs text-slate-500 mt-1">
  589. Automatically start playing a selected playlist when the system boots up.
  590. </p>
  591. </div>
  592. <label class="switch">
  593. <input type="checkbox" id="auto_playModeToggle">
  594. <span class="slider round"></span>
  595. </label>
  596. </div>
  597. <div id="auto_playSettings" class="space-y-4" style="display: none;">
  598. <label class="flex flex-col gap-1.5">
  599. <span class="text-slate-700 text-sm font-medium leading-normal">Startup Playlist</span>
  600. <select
  601. id="auto_playPlaylistSelect"
  602. 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"
  603. >
  604. <option value="">Select a playlist...</option>
  605. </select>
  606. <p class="text-xs text-slate-500 mt-1">
  607. Choose which playlist to automatically play when the system starts.
  608. </p>
  609. </label>
  610. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  611. <label class="flex flex-col gap-1.5">
  612. <span class="text-slate-700 text-sm font-medium leading-normal">Run Mode</span>
  613. <select
  614. id="auto_playRunModeSelect"
  615. 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"
  616. >
  617. <option value="single">Single (play once)</option>
  618. <option value="loop">Loop (repeat forever)</option>
  619. </select>
  620. <p class="text-xs text-slate-500 mt-1">
  621. How to run the playlist when it finishes.
  622. </p>
  623. </label>
  624. <label class="flex flex-col gap-1.5">
  625. <span class="text-slate-700 text-sm font-medium leading-normal">Pause Between Patterns (seconds)</span>
  626. <input
  627. id="auto_playPauseTimeInput"
  628. type="number"
  629. min="0"
  630. step="0.5"
  631. 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"
  632. placeholder="5.0"
  633. />
  634. <p class="text-xs text-slate-500 mt-1">
  635. Time to wait between each pattern (0 or more seconds).
  636. </p>
  637. </label>
  638. </div>
  639. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  640. <label class="flex flex-col gap-1.5">
  641. <span class="text-slate-700 text-sm font-medium leading-normal">Clear Pattern</span>
  642. <select
  643. id="auto_playClearPatternSelect"
  644. 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"
  645. >
  646. <option value="none">None</option>
  647. <option value="adaptive">Adaptive</option>
  648. <option value="clear_from_in">Clear From Center</option>
  649. <option value="clear_from_out">Clear From Perimeter</option>
  650. <option value="clear_sideway">Clear Sideway</option>
  651. <option value="random">Random</option>
  652. </select>
  653. <p class="text-xs text-slate-500 mt-1">
  654. Pattern to run before each main pattern.
  655. </p>
  656. </label>
  657. <div class="flex items-center justify-between">
  658. <div class="flex-1">
  659. <h4 class="text-slate-700 text-sm font-medium leading-normal">Shuffle Playlist</h4>
  660. <p class="text-xs text-slate-500 mt-1">
  661. Randomize the order of patterns in the playlist.
  662. </p>
  663. </div>
  664. <label class="switch">
  665. <input type="checkbox" id="auto_playShuffleToggle">
  666. <span class="slider round"></span>
  667. </label>
  668. </div>
  669. </div>
  670. </div>
  671. </div>
  672. </section>
  673. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  674. <h2
  675. 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"
  676. >
  677. Still Sands
  678. </h2>
  679. <div class="px-6 py-5 space-y-6">
  680. <div class="flex items-center justify-between">
  681. <div class="flex-1">
  682. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Still Sands</h3>
  683. <p class="text-xs text-slate-500 mt-1">
  684. Automatically bring the sands to rest during specified time periods.
  685. </p>
  686. </div>
  687. <label class="switch">
  688. <input type="checkbox" id="scheduledPauseToggle">
  689. <span class="slider round"></span>
  690. </label>
  691. </div>
  692. <div id="scheduledPauseSettings" class="space-y-4" style="display: none;">
  693. <!-- WLED Control Option -->
  694. <div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
  695. <div class="flex items-center justify-between">
  696. <div class="flex-1">
  697. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  698. <span class="material-icons text-amber-600 text-base">lightbulb</span>
  699. Control WLED Lights
  700. </h4>
  701. <p class="text-xs text-slate-600 mt-1">
  702. Turn off WLED lights during still periods for complete rest
  703. </p>
  704. </div>
  705. <label class="switch">
  706. <input type="checkbox" id="stillSandsWledControl">
  707. <span class="slider round"></span>
  708. </label>
  709. </div>
  710. </div>
  711. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  712. <div class="flex items-center justify-between">
  713. <h4 class="text-slate-800 text-base font-semibold">Still Periods</h4>
  714. <button
  715. id="addTimeSlotButton"
  716. 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"
  717. >
  718. <span class="material-icons text-base">add</span>
  719. <span>Add Still Period</span>
  720. </button>
  721. </div>
  722. <p class="text-sm text-slate-600">
  723. Define time periods when the sands should rest in stillness. Patterns will resume automatically when still periods end.
  724. </p>
  725. <div id="timeSlotsContainer" class="space-y-3">
  726. <!-- Time slots will be dynamically added here -->
  727. </div>
  728. <div class="text-xs text-slate-500 bg-blue-50 border border-blue-200 rounded-lg p-3">
  729. <div class="flex items-start gap-2">
  730. <span class="material-icons text-blue-600 text-base">info</span>
  731. <div>
  732. <p class="font-medium text-blue-800">Important Notes:</p>
  733. <ul class="mt-1 space-y-1 text-blue-700">
  734. <li>• Times are based on your system's local time zone</li>
  735. <li>• Currently running patterns will pause immediately when entering a still period</li>
  736. <li>• Patterns will resume automatically when exiting a still period</li>
  737. <li>• Still periods that span midnight (e.g., 22:00 to 06:00) are supported</li>
  738. </ul>
  739. </div>
  740. </div>
  741. </div>
  742. </div>
  743. <div class="flex justify-end">
  744. <button
  745. id="savePauseSettings"
  746. 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"
  747. >
  748. <span class="material-icons text-lg">save</span>
  749. <span class="truncate">Save Still Sands</span>
  750. </button>
  751. </div>
  752. </div>
  753. </div>
  754. </section>
  755. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  756. <h2
  757. 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"
  758. >
  759. Software Version
  760. </h2>
  761. <div class="divide-y divide-slate-100">
  762. <div class="flex items-center gap-4 px-6 py-5">
  763. <div
  764. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  765. >
  766. <span class="material-icons text-3xl">terminal</span>
  767. </div>
  768. <div class="flex-1">
  769. <p class="text-slate-800 text-base font-medium leading-normal">
  770. Current Version
  771. </p>
  772. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  773. </div>
  774. </div>
  775. <div class="flex items-center gap-4 px-6 py-5">
  776. <div
  777. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  778. >
  779. <span class="material-icons text-3xl">system_update</span>
  780. </div>
  781. <div class="flex-1">
  782. <p class="text-slate-800 text-base font-medium leading-normal">
  783. Latest Version
  784. </p>
  785. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  786. </div>
  787. <button
  788. id="updateSoftware"
  789. 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"
  790. disabled
  791. >
  792. <span id="updateIcon" class="material-icons text-base">download</span>
  793. <span id="updateText" class="truncate">Update</span>
  794. </button>
  795. </div>
  796. </div>
  797. </section>
  798. </div>
  799. {% endblock %} {% block scripts %}
  800. <script src="/static/js/settings.js"></script>
  801. {% endblock %}