1
0

settings.html 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  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. <!-- Homing Configuration Section -->
  302. <section id="homingSection" class="bg-white rounded-xl shadow-sm overflow-hidden">
  303. <h2
  304. 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"
  305. >
  306. Homing Configuration
  307. </h2>
  308. <div class="px-6 py-5 space-y-6">
  309. <!-- Homing Mode Selection -->
  310. <div class="space-y-3">
  311. <label class="text-sm font-medium text-slate-700 flex items-center gap-2">
  312. <span class="material-icons text-slate-600 text-base">home</span>
  313. Homing Mode
  314. </label>
  315. <div class="space-y-3">
  316. <!-- Crash Homing Option -->
  317. <label class="flex items-start gap-3 p-3 border border-slate-300 rounded-lg cursor-pointer hover:bg-slate-50 transition-colors">
  318. <input
  319. type="radio"
  320. name="homingMode"
  321. value="0"
  322. id="homingModeCrash"
  323. class="mt-0.5 w-4 h-4 text-sky-600 focus:ring-sky-500"
  324. />
  325. <div class="flex-1">
  326. <div class="text-sm font-medium text-slate-700">Crash Homing</div>
  327. <div class="text-xs text-slate-500 mt-1">
  328. Y axis moves until physical stop, then theta and rho set to 0 (no x0 y0 command)
  329. </div>
  330. </div>
  331. </label>
  332. <!-- Sensor Homing Option -->
  333. <label class="flex items-start gap-3 p-3 border border-slate-300 rounded-lg cursor-pointer hover:bg-slate-50 transition-colors">
  334. <input
  335. type="radio"
  336. name="homingMode"
  337. value="1"
  338. id="homingModeSensor"
  339. class="mt-0.5 w-4 h-4 text-sky-600 focus:ring-sky-500"
  340. />
  341. <div class="flex-1">
  342. <div class="text-sm font-medium text-slate-700">Sensor Homing ($H command)</div>
  343. <div class="text-xs text-slate-500 mt-1">
  344. Homes both X and Y axes via FluidNC firmware, then zeroes positions with x0 y0
  345. </div>
  346. </div>
  347. </label>
  348. </div>
  349. </div>
  350. <!-- Compass Reference Point (Sensor mode only) -->
  351. <div id="compassOffsetContainer" class="space-y-2">
  352. <label for="angularOffsetInput" class="text-sm font-medium text-slate-700 flex items-center gap-2">
  353. <span class="material-icons text-slate-600 text-base">explore</span>
  354. Compass Reference Point (degrees) <span class="text-xs text-slate-400">(Sensor mode only)</span>
  355. </label>
  356. <input
  357. type="number"
  358. id="angularOffsetInput"
  359. min="0"
  360. max="360"
  361. step="0.1"
  362. value="0"
  363. 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"
  364. placeholder="0.0"
  365. />
  366. <p class="text-xs text-slate-500">
  367. Set the angle (in degrees) where your angular sensor is physically mounted. After sensor homing, theta will be set to this value. 0° = East, increases clockwise (90° = South, 180° = West, 270° = North).
  368. </p>
  369. </div>
  370. <!-- Homing Info Box -->
  371. <div id="homingInfoBox" class="text-xs text-slate-600 bg-blue-50 border border-blue-200 rounded-lg p-3">
  372. <div class="flex items-start gap-2">
  373. <span class="material-icons text-blue-600 text-base">info</span>
  374. <div id="homingInfoContent">
  375. <p class="font-medium text-blue-800">Crash Homing Mode:</p>
  376. <ul class="mt-1 space-y-1 text-blue-700">
  377. <li>• Y axis moves -22mm (or -30mm for mini) until physical stop</li>
  378. <li>• Theta set to 0, rho set to 0</li>
  379. <li>• No x0 y0 command sent</li>
  380. <li>• No hardware sensors required</li>
  381. </ul>
  382. </div>
  383. </div>
  384. </div>
  385. <div class="flex justify-end">
  386. <button
  387. id="saveHomingConfig"
  388. 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"
  389. >
  390. <span class="material-icons text-lg">save</span>
  391. <span class="truncate">Save Configuration</span>
  392. </button>
  393. </div>
  394. </div>
  395. </section>
  396. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  397. <h2
  398. 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"
  399. >
  400. Application Settings
  401. </h2>
  402. <div class="px-6 py-5 space-y-6">
  403. <label class="flex flex-col gap-1.5">
  404. <span class="text-slate-700 text-sm font-medium leading-normal"
  405. >Application Name</span
  406. >
  407. <div class="flex gap-3 items-center">
  408. <div class="relative flex-1">
  409. <input
  410. id="appNameInput"
  411. 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"
  412. placeholder="e.g., Dune Weaver"
  413. value="Dune Weaver"
  414. />
  415. <button
  416. type="button"
  417. onclick="document.getElementById('appNameInput').value='Dune Weaver';"
  418. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  419. aria-label="Reset to default"
  420. title="Reset to default"
  421. >
  422. <span class="material-icons">restart_alt</span>
  423. </button>
  424. </div>
  425. <button
  426. id="saveAppName"
  427. 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"
  428. >
  429. <span class="material-icons text-lg">save</span>
  430. <span class="truncate">Save Name</span>
  431. </button>
  432. </div>
  433. <p class="text-xs text-slate-500 mt-2">
  434. This name will appear in the browser tab and at the top of every page.
  435. </p>
  436. </label>
  437. </div>
  438. </section>
  439. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  440. <h2
  441. 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"
  442. >
  443. Pattern Clearing
  444. </h2>
  445. <div class="px-6 py-5 space-y-6">
  446. <p class="text-sm text-slate-600">
  447. Customize the clearing behavior used when transitioning between patterns. Set custom patterns and speed to control how sand is distributed.
  448. </p>
  449. <!-- Clearing Speed Section -->
  450. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  451. <h3 class="text-slate-800 text-base font-semibold">Clearing Speed</h3>
  452. <p class="text-sm text-slate-600">
  453. 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.
  454. </p>
  455. <div class="flex flex-col gap-1.5">
  456. <label for="clearPatternSpeedInput" class="text-slate-700 text-sm font-medium leading-normal">
  457. Speed (steps per minute)
  458. </label>
  459. <div class="flex gap-3 items-center">
  460. <input
  461. id="clearPatternSpeedInput"
  462. type="number"
  463. min="50"
  464. max="2000"
  465. step="50"
  466. 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"
  467. placeholder="Default (use pattern speed)"
  468. value=""
  469. />
  470. <button
  471. id="saveClearSpeed"
  472. 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"
  473. >
  474. <span class="material-icons text-lg">save</span>
  475. <span class="truncate">Save Speed</span>
  476. </button>
  477. </div>
  478. <div id="effectiveClearSpeed" class="text-xs text-slate-500 mt-1"></div>
  479. </div>
  480. </div>
  481. <!-- Custom Patterns Section -->
  482. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  483. <h3 class="text-slate-800 text-base font-semibold">Custom Clear Patterns</h3>
  484. <p class="text-sm text-slate-600">
  485. Choose specific patterns to use when clearing. Leave empty to use the default clearing behavior.
  486. </p>
  487. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  488. <div class="flex flex-col gap-1.5">
  489. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  490. <div class="relative">
  491. <input
  492. id="customClearFromInInput"
  493. type="text"
  494. 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"
  495. placeholder="Type to search patterns or leave empty for default"
  496. autocomplete="off"
  497. />
  498. <button
  499. type="button"
  500. id="clearFromInClear"
  501. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  502. aria-label="Clear selection"
  503. title="Clear selection"
  504. >
  505. <span class="material-icons text-xl">close</span>
  506. </button>
  507. <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>
  508. </div>
  509. <p class="text-xs text-slate-500 mt-1">
  510. Pattern to use when clearing from the center outward.
  511. </p>
  512. </div>
  513. <div class="flex flex-col gap-1.5">
  514. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  515. <div class="relative">
  516. <input
  517. id="customClearFromOutInput"
  518. type="text"
  519. 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"
  520. placeholder="Type to search patterns or leave empty for default"
  521. autocomplete="off"
  522. />
  523. <button
  524. type="button"
  525. id="clearFromOutClear"
  526. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  527. aria-label="Clear selection"
  528. title="Clear selection"
  529. >
  530. <span class="material-icons text-xl">close</span>
  531. </button>
  532. <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>
  533. </div>
  534. <p class="text-xs text-slate-500 mt-1">
  535. Pattern to use when clearing from the perimeter inward.
  536. </p>
  537. </div>
  538. </div>
  539. <div class="flex justify-end">
  540. <button
  541. id="saveClearPatterns"
  542. 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"
  543. >
  544. <span class="material-icons text-lg">save</span>
  545. <span class="truncate">Save Patterns</span>
  546. </button>
  547. </div>
  548. </div>
  549. </div>
  550. </section>
  551. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  552. <h2
  553. 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"
  554. >
  555. LED Controller Configuration
  556. </h2>
  557. <div class="px-6 py-5 space-y-6">
  558. <!-- LED Provider Selection -->
  559. <div class="flex flex-col gap-2">
  560. <span class="text-slate-700 text-sm font-medium leading-normal">LED Provider</span>
  561. <div class="flex gap-3">
  562. <label class="flex items-center gap-2 cursor-pointer">
  563. <input type="radio" name="ledProvider" value="none" id="ledProviderNone" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  564. <span class="text-sm text-slate-700">None</span>
  565. </label>
  566. <label class="flex items-center gap-2 cursor-pointer">
  567. <input type="radio" name="ledProvider" value="wled" id="ledProviderWled" class="w-4 h-4 text-sky-600 border-slate-300 focus:ring-sky-500">
  568. <span class="text-sm text-slate-700">WLED</span>
  569. </label>
  570. <label class="flex items-center gap-2 cursor-pointer">
  571. <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">
  572. <span class="text-sm text-slate-700">DW LEDs (Local GPIO)</span>
  573. </label>
  574. </div>
  575. <p class="text-xs text-slate-500">
  576. Select your LED control system (settings are mutually exclusive)
  577. </p>
  578. </div>
  579. <!-- WLED Configuration (shown when WLED is selected) -->
  580. <div id="wledConfig" class="flex flex-col gap-4 hidden">
  581. <label class="flex flex-col gap-1.5">
  582. <span class="text-slate-700 text-sm font-medium leading-normal">WLED IP Address</span>
  583. <div class="relative flex-1">
  584. <input
  585. id="wledIpInput"
  586. 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"
  587. placeholder="e.g., 192.168.1.100"
  588. value=""
  589. />
  590. <button
  591. type="button"
  592. onclick="document.getElementById('wledIpInput').value='';"
  593. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  594. aria-label="Clear WLED IP"
  595. >
  596. <span class="material-icons">close</span>
  597. </button>
  598. </div>
  599. <p class="text-xs text-slate-500">
  600. Enter the IP address of your WLED controller
  601. </p>
  602. </label>
  603. </div>
  604. <!-- DW LEDs Configuration (shown when DW LEDs is selected) -->
  605. <div id="dwLedsConfig" class="flex flex-col gap-4 hidden">
  606. <div class="bg-blue-50 border border-blue-200 rounded-lg p-3">
  607. <div class="flex items-start gap-2">
  608. <span class="material-icons text-blue-600 text-base">info</span>
  609. <div class="text-xs text-blue-700">
  610. <p class="font-medium text-blue-800">Supported LED Strips: WS281x Only</p>
  611. <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>
  612. </div>
  613. </div>
  614. </div>
  615. <label class="flex flex-col gap-1.5">
  616. <span class="text-slate-700 text-sm font-medium leading-normal">Number of LEDs</span>
  617. <input
  618. id="dwLedNumLeds"
  619. type="number"
  620. 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"
  621. placeholder="60"
  622. value="60"
  623. min="1"
  624. max="1000"
  625. />
  626. <p class="text-xs text-slate-500">
  627. Total number of LEDs in your WS281x strip
  628. </p>
  629. </label>
  630. <label class="flex flex-col gap-1.5">
  631. <span class="text-slate-700 text-sm font-medium leading-normal">GPIO Pin</span>
  632. <select
  633. id="dwLedGpioPin"
  634. 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"
  635. >
  636. <option value="12">GPIO 12 (PWM0)</option>
  637. <option value="13">GPIO 13 (PWM1)</option>
  638. <option value="18">GPIO 18 (PWM0)</option>
  639. <option value="19">GPIO 19 (PWM1)</option>
  640. </select>
  641. <p class="text-xs text-slate-500">
  642. Select a PWM-capable GPIO pin for WS281x timing
  643. </p>
  644. </label>
  645. <label class="flex flex-col gap-1.5">
  646. <span class="text-slate-700 text-sm font-medium leading-normal">Pixel Color Order (WS281x)</span>
  647. <select
  648. id="dwLedPixelOrder"
  649. 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"
  650. >
  651. <option value="GRB" selected>GRB - WS2812/WS2812B (most common)</option>
  652. <option value="RGB">RGB - WS2815/WS2811 and some variants</option>
  653. <option value="BGR">BGR - Some WS2811 variants</option>
  654. <option value="RBG">RBG - Rare variant</option>
  655. <option value="GBR">GBR - Rare variant</option>
  656. <option value="BRG">BRG - Rare variant</option>
  657. </select>
  658. <p class="text-xs text-slate-500">
  659. Most WS2812B and WS2815 strips use GRB. WS2811 often uses RGB. If colors appear wrong, try different orders.
  660. </p>
  661. </label>
  662. </div>
  663. <!-- Save Button -->
  664. <button
  665. id="saveLedConfig"
  666. 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"
  667. >
  668. <span class="material-icons text-lg">save</span>
  669. <span class="truncate">Save LED Configuration</span>
  670. </button>
  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. Auto-play on Boot
  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 Auto-play on Boot</h3>
  683. <p class="text-xs text-slate-500 mt-1">
  684. Automatically start playing a selected playlist when the system boots up.
  685. </p>
  686. </div>
  687. <label class="switch">
  688. <input type="checkbox" id="auto_playModeToggle">
  689. <span class="slider round"></span>
  690. </label>
  691. </div>
  692. <div id="auto_playSettings" class="space-y-4" style="display: none;">
  693. <label class="flex flex-col gap-1.5">
  694. <span class="text-slate-700 text-sm font-medium leading-normal">Startup Playlist</span>
  695. <select
  696. id="auto_playPlaylistSelect"
  697. 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"
  698. >
  699. <option value="">Select a playlist...</option>
  700. </select>
  701. <p class="text-xs text-slate-500 mt-1">
  702. Choose which playlist to automatically play when the system starts.
  703. </p>
  704. </label>
  705. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  706. <label class="flex flex-col gap-1.5">
  707. <span class="text-slate-700 text-sm font-medium leading-normal">Run Mode</span>
  708. <select
  709. id="auto_playRunModeSelect"
  710. 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"
  711. >
  712. <option value="single">Single (play once)</option>
  713. <option value="loop">Loop (repeat forever)</option>
  714. </select>
  715. <p class="text-xs text-slate-500 mt-1">
  716. How to run the playlist when it finishes.
  717. </p>
  718. </label>
  719. <label class="flex flex-col gap-1.5">
  720. <span class="text-slate-700 text-sm font-medium leading-normal">Pause Between Patterns (seconds)</span>
  721. <input
  722. id="auto_playPauseTimeInput"
  723. type="number"
  724. min="0"
  725. step="0.5"
  726. 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"
  727. placeholder="5.0"
  728. />
  729. <p class="text-xs text-slate-500 mt-1">
  730. Time to wait between each pattern (0 or more seconds).
  731. </p>
  732. </label>
  733. </div>
  734. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  735. <label class="flex flex-col gap-1.5">
  736. <span class="text-slate-700 text-sm font-medium leading-normal">Clear Pattern</span>
  737. <select
  738. id="auto_playClearPatternSelect"
  739. 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"
  740. >
  741. <option value="none">None</option>
  742. <option value="adaptive">Adaptive</option>
  743. <option value="clear_from_in">Clear From Center</option>
  744. <option value="clear_from_out">Clear From Perimeter</option>
  745. <option value="clear_sideway">Clear Sideway</option>
  746. <option value="random">Random</option>
  747. </select>
  748. <p class="text-xs text-slate-500 mt-1">
  749. Pattern to run before each main pattern.
  750. </p>
  751. </label>
  752. <div class="flex items-center justify-between">
  753. <div class="flex-1">
  754. <h4 class="text-slate-700 text-sm font-medium leading-normal">Shuffle Playlist</h4>
  755. <p class="text-xs text-slate-500 mt-1">
  756. Randomize the order of patterns in the playlist.
  757. </p>
  758. </div>
  759. <label class="switch">
  760. <input type="checkbox" id="auto_playShuffleToggle">
  761. <span class="slider round"></span>
  762. </label>
  763. </div>
  764. </div>
  765. </div>
  766. </div>
  767. </section>
  768. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  769. <h2
  770. 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"
  771. >
  772. Still Sands
  773. </h2>
  774. <div class="px-6 py-5 space-y-6">
  775. <div class="flex items-center justify-between">
  776. <div class="flex-1">
  777. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Still Sands</h3>
  778. <p class="text-xs text-slate-500 mt-1">
  779. Automatically bring the sands to rest during specified time periods.
  780. </p>
  781. </div>
  782. <label class="switch">
  783. <input type="checkbox" id="scheduledPauseToggle">
  784. <span class="slider round"></span>
  785. </label>
  786. </div>
  787. <div id="scheduledPauseSettings" class="space-y-4" style="display: none;">
  788. <!-- WLED Control Option -->
  789. <div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
  790. <div class="flex items-center justify-between">
  791. <div class="flex-1">
  792. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  793. <span class="material-icons text-amber-600 text-base">lightbulb</span>
  794. Control WLED Lights
  795. </h4>
  796. <p class="text-xs text-slate-600 mt-1">
  797. Turn off WLED lights during still periods for complete rest
  798. </p>
  799. </div>
  800. <label class="switch">
  801. <input type="checkbox" id="stillSandsWledControl">
  802. <span class="slider round"></span>
  803. </label>
  804. </div>
  805. </div>
  806. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  807. <div class="flex items-center justify-between">
  808. <h4 class="text-slate-800 text-base font-semibold">Still Periods</h4>
  809. <button
  810. id="addTimeSlotButton"
  811. 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"
  812. >
  813. <span class="material-icons text-base">add</span>
  814. <span>Add Still Period</span>
  815. </button>
  816. </div>
  817. <p class="text-sm text-slate-600">
  818. Define time periods when the sands should rest in stillness. Patterns will resume automatically when still periods end.
  819. </p>
  820. <div id="timeSlotsContainer" class="space-y-3">
  821. <!-- Time slots will be dynamically added here -->
  822. </div>
  823. <div class="text-xs text-slate-500 bg-blue-50 border border-blue-200 rounded-lg p-3">
  824. <div class="flex items-start gap-2">
  825. <span class="material-icons text-blue-600 text-base">info</span>
  826. <div>
  827. <p class="font-medium text-blue-800">Important Notes:</p>
  828. <ul class="mt-1 space-y-1 text-blue-700">
  829. <li>• Times are based on your system's local time zone</li>
  830. <li>• Currently running patterns will pause immediately when entering a still period</li>
  831. <li>• Patterns will resume automatically when exiting a still period</li>
  832. <li>• Still periods that span midnight (e.g., 22:00 to 06:00) are supported</li>
  833. </ul>
  834. </div>
  835. </div>
  836. </div>
  837. </div>
  838. <div class="flex justify-end">
  839. <button
  840. id="savePauseSettings"
  841. 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"
  842. >
  843. <span class="material-icons text-lg">save</span>
  844. <span class="truncate">Save Still Sands</span>
  845. </button>
  846. </div>
  847. </div>
  848. </div>
  849. </section>
  850. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  851. <h2
  852. 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"
  853. >
  854. Software Version
  855. </h2>
  856. <div class="divide-y divide-slate-100">
  857. <div class="flex items-center gap-4 px-6 py-5">
  858. <div
  859. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  860. >
  861. <span class="material-icons text-3xl">terminal</span>
  862. </div>
  863. <div class="flex-1">
  864. <p class="text-slate-800 text-base font-medium leading-normal">
  865. Current Version
  866. </p>
  867. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  868. </div>
  869. </div>
  870. <div class="flex items-center gap-4 px-6 py-5">
  871. <div
  872. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  873. >
  874. <span class="material-icons text-3xl">system_update</span>
  875. </div>
  876. <div class="flex-1">
  877. <p class="text-slate-800 text-base font-medium leading-normal">
  878. Latest Version
  879. </p>
  880. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  881. </div>
  882. <button
  883. id="updateSoftware"
  884. 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"
  885. disabled
  886. >
  887. <span id="updateIcon" class="material-icons text-base">download</span>
  888. <span id="updateText" class="truncate">Update</span>
  889. </button>
  890. </div>
  891. </div>
  892. </section>
  893. </div>
  894. {% endblock %} {% block scripts %}
  895. <script src="/static/js/settings.js"></script>
  896. {% endblock %}