1
0

settings.html 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  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: WS281x Only</p>
  615. <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>
  616. </div>
  617. </div>
  618. </div>
  619. <label class="flex flex-col gap-1.5">
  620. <span class="text-slate-700 text-sm font-medium leading-normal">Number of LEDs</span>
  621. <input
  622. id="dwLedNumLeds"
  623. type="number"
  624. 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"
  625. placeholder="60"
  626. value="60"
  627. min="1"
  628. max="1000"
  629. />
  630. <p class="text-xs text-slate-500">
  631. Total number of LEDs in your WS281x strip
  632. </p>
  633. </label>
  634. <label class="flex flex-col gap-1.5">
  635. <span class="text-slate-700 text-sm font-medium leading-normal">GPIO Pin</span>
  636. <select
  637. id="dwLedGpioPin"
  638. 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"
  639. >
  640. <option value="12">GPIO 12 (PWM0)</option>
  641. <option value="13">GPIO 13 (PWM1)</option>
  642. <option value="18">GPIO 18 (PWM0)</option>
  643. <option value="19">GPIO 19 (PWM1)</option>
  644. </select>
  645. <p class="text-xs text-slate-500">
  646. Select a PWM-capable GPIO pin for WS281x timing
  647. </p>
  648. </label>
  649. <label class="flex flex-col gap-1.5">
  650. <span class="text-slate-700 text-sm font-medium leading-normal">Pixel Color Order (WS281x)</span>
  651. <select
  652. id="dwLedPixelOrder"
  653. 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"
  654. >
  655. <option value="GRB" selected>GRB - WS2812/WS2812B (most common)</option>
  656. <option value="RGB">RGB - WS2815/WS2811 and some variants</option>
  657. <option value="BGR">BGR - Some WS2811 variants</option>
  658. <option value="RBG">RBG - Rare variant</option>
  659. <option value="GBR">GBR - Rare variant</option>
  660. <option value="BRG">BRG - Rare variant</option>
  661. </select>
  662. <p class="text-xs text-slate-500">
  663. Most WS2812B and WS2815 strips use GRB. WS2811 often uses RGB. If colors appear wrong, try different orders.
  664. </p>
  665. </label>
  666. </div>
  667. <!-- Save Button -->
  668. <button
  669. id="saveLedConfig"
  670. 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"
  671. >
  672. <span class="material-icons text-lg">save</span>
  673. <span class="truncate">Save LED Configuration</span>
  674. </button>
  675. </div>
  676. </section>
  677. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  678. <h2
  679. 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"
  680. >
  681. Auto-play on Boot
  682. </h2>
  683. <div class="px-6 py-5 space-y-6">
  684. <div class="flex items-center justify-between">
  685. <div class="flex-1">
  686. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Auto-play on Boot</h3>
  687. <p class="text-xs text-slate-500 mt-1">
  688. Automatically start playing a selected playlist when the system boots up.
  689. </p>
  690. </div>
  691. <label class="switch">
  692. <input type="checkbox" id="auto_playModeToggle">
  693. <span class="slider round"></span>
  694. </label>
  695. </div>
  696. <div id="auto_playSettings" class="space-y-4" style="display: none;">
  697. <label class="flex flex-col gap-1.5">
  698. <span class="text-slate-700 text-sm font-medium leading-normal">Startup Playlist</span>
  699. <select
  700. id="auto_playPlaylistSelect"
  701. 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"
  702. >
  703. <option value="">Select a playlist...</option>
  704. </select>
  705. <p class="text-xs text-slate-500 mt-1">
  706. Choose which playlist to automatically play when the system starts.
  707. </p>
  708. </label>
  709. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  710. <label class="flex flex-col gap-1.5">
  711. <span class="text-slate-700 text-sm font-medium leading-normal">Run Mode</span>
  712. <select
  713. id="auto_playRunModeSelect"
  714. 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"
  715. >
  716. <option value="single">Single (play once)</option>
  717. <option value="loop">Loop (repeat forever)</option>
  718. </select>
  719. <p class="text-xs text-slate-500 mt-1">
  720. How to run the playlist when it finishes.
  721. </p>
  722. </label>
  723. <label class="flex flex-col gap-1.5">
  724. <span class="text-slate-700 text-sm font-medium leading-normal">Pause Between Patterns (seconds)</span>
  725. <input
  726. id="auto_playPauseTimeInput"
  727. type="number"
  728. min="0"
  729. step="0.5"
  730. 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"
  731. placeholder="5.0"
  732. />
  733. <p class="text-xs text-slate-500 mt-1">
  734. Time to wait between each pattern (0 or more seconds).
  735. </p>
  736. </label>
  737. </div>
  738. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  739. <label class="flex flex-col gap-1.5">
  740. <span class="text-slate-700 text-sm font-medium leading-normal">Clear Pattern</span>
  741. <select
  742. id="auto_playClearPatternSelect"
  743. 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"
  744. >
  745. <option value="none">None</option>
  746. <option value="adaptive">Adaptive</option>
  747. <option value="clear_from_in">Clear From Center</option>
  748. <option value="clear_from_out">Clear From Perimeter</option>
  749. <option value="clear_sideway">Clear Sideway</option>
  750. <option value="random">Random</option>
  751. </select>
  752. <p class="text-xs text-slate-500 mt-1">
  753. Pattern to run before each main pattern.
  754. </p>
  755. </label>
  756. <div class="flex items-center justify-between">
  757. <div class="flex-1">
  758. <h4 class="text-slate-700 text-sm font-medium leading-normal">Shuffle Playlist</h4>
  759. <p class="text-xs text-slate-500 mt-1">
  760. Randomize the order of patterns in the playlist.
  761. </p>
  762. </div>
  763. <label class="switch">
  764. <input type="checkbox" id="auto_playShuffleToggle">
  765. <span class="slider round"></span>
  766. </label>
  767. </div>
  768. </div>
  769. </div>
  770. </div>
  771. </section>
  772. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  773. <h2
  774. 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"
  775. >
  776. Still Sands
  777. </h2>
  778. <div class="px-6 py-5 space-y-6">
  779. <div class="flex items-center justify-between">
  780. <div class="flex-1">
  781. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Still Sands</h3>
  782. <p class="text-xs text-slate-500 mt-1">
  783. Automatically bring the sands to rest during specified time periods.
  784. </p>
  785. </div>
  786. <label class="switch">
  787. <input type="checkbox" id="scheduledPauseToggle">
  788. <span class="slider round"></span>
  789. </label>
  790. </div>
  791. <div id="scheduledPauseSettings" class="space-y-4" style="display: none;">
  792. <!-- WLED Control Option -->
  793. <div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
  794. <div class="flex items-center justify-between">
  795. <div class="flex-1">
  796. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  797. <span class="material-icons text-amber-600 text-base">lightbulb</span>
  798. Control WLED Lights
  799. </h4>
  800. <p class="text-xs text-slate-600 mt-1">
  801. Turn off WLED lights during still periods for complete rest
  802. </p>
  803. </div>
  804. <label class="switch">
  805. <input type="checkbox" id="stillSandsWledControl">
  806. <span class="slider round"></span>
  807. </label>
  808. </div>
  809. </div>
  810. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  811. <div class="flex items-center justify-between">
  812. <h4 class="text-slate-800 text-base font-semibold">Still Periods</h4>
  813. <button
  814. id="addTimeSlotButton"
  815. 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"
  816. >
  817. <span class="material-icons text-base">add</span>
  818. <span>Add Still Period</span>
  819. </button>
  820. </div>
  821. <p class="text-sm text-slate-600">
  822. Define time periods when the sands should rest in stillness. Patterns will resume automatically when still periods end.
  823. </p>
  824. <div id="timeSlotsContainer" class="space-y-3">
  825. <!-- Time slots will be dynamically added here -->
  826. </div>
  827. <div class="text-xs text-slate-500 bg-blue-50 border border-blue-200 rounded-lg p-3">
  828. <div class="flex items-start gap-2">
  829. <span class="material-icons text-blue-600 text-base">info</span>
  830. <div>
  831. <p class="font-medium text-blue-800">Important Notes:</p>
  832. <ul class="mt-1 space-y-1 text-blue-700">
  833. <li>• Times are based on your system's local time zone</li>
  834. <li>• Currently running patterns will pause immediately when entering a still period</li>
  835. <li>• Patterns will resume automatically when exiting a still period</li>
  836. <li>• Still periods that span midnight (e.g., 22:00 to 06:00) are supported</li>
  837. </ul>
  838. </div>
  839. </div>
  840. </div>
  841. </div>
  842. <div class="flex justify-end">
  843. <button
  844. id="savePauseSettings"
  845. 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"
  846. >
  847. <span class="material-icons text-lg">save</span>
  848. <span class="truncate">Save Still Sands</span>
  849. </button>
  850. </div>
  851. </div>
  852. </div>
  853. </section>
  854. <section id="software-version-section" class="bg-white rounded-xl shadow-sm overflow-hidden">
  855. <h2
  856. 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"
  857. >
  858. Software Version
  859. </h2>
  860. <div class="divide-y divide-slate-100">
  861. <div class="flex items-center gap-4 px-6 py-5">
  862. <div
  863. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  864. >
  865. <span class="material-icons text-3xl">terminal</span>
  866. </div>
  867. <div class="flex-1">
  868. <p class="text-slate-800 text-base font-medium leading-normal">
  869. Current Version
  870. </p>
  871. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  872. </div>
  873. </div>
  874. <div class="flex items-center gap-4 px-6 py-5">
  875. <div
  876. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  877. >
  878. <span class="material-icons text-3xl">system_update</span>
  879. </div>
  880. <div class="flex-1">
  881. <p class="text-slate-800 text-base font-medium leading-normal">
  882. Latest Version
  883. </p>
  884. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  885. </div>
  886. <button
  887. id="updateSoftware"
  888. 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"
  889. disabled
  890. >
  891. <span id="updateIcon" class="material-icons text-base">download</span>
  892. <span id="updateText" class="truncate">Update</span>
  893. </button>
  894. </div>
  895. </div>
  896. </section>
  897. </div>
  898. {% endblock %} {% block scripts %}
  899. <script src="/static/js/settings.js"></script>
  900. {% endblock %}