whycomeimsocool

Untitled

Feb 7th, 2025 (edited)
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.63 KB | None | 0 0
  1. hw/loneoceans/lume-x1-avr32dd20/anduril.h
  2.  
  3. (model 4212)
  4.  
  5. // Copyright (C) 2017-2023 Selene ToyKeeper
  6. // 2021-2024 Loneoceans
  7. // SPDX-License-Identifier: GPL-3.0-or-later
  8. #pragma once
  9.  
  10. //**************************************************
  11. //** CONFIGURATION OPTIONS FOR LUME-X1-AVR32DD20 **
  12. //**************************************************
  13.  
  14. #define HWDEF_H loneoceans/lume-x1-avr32dd20/hwdef.h
  15.  
  16. //***************************************
  17. //** RAMP TABLE AND OPERATIONS **
  18. //***************************************
  19.  
  20. #define RAMP_SIZE 150 // Change to 160 as well as table and values below if desired
  21.  
  22. // PWM1: DAC Data
  23. // UDR x^4 curves specifically for Lume-X1 (AVR32DD20)
  24.  
  25. // 150 levels:
  26. #define PWM1_LEVELS 1, 2, 10, 31, 77, 159, 295, 504, 807, 504, 737, 1023, 14, 19, 25, 32, 41, 52, 65, 79, 96, 116, 139, 164, 194, 226, 263, 305, 351, 401, 458, 520, 588, 662, 744, 832, 929, 423, 470, 520, 574, 632, 694, 761, 832, 909, 991, 27, 29, 31, 33, 36, 39, 42, 45, 48, 51, 55, 59, 63, 67, 71, 76, 81, 86, 91, 96, 102, 108, 114, 121, 128, 135, 142, 149, 157, 165, 174, 183, 192, 201, 211, 221, 232, 242, 254, 265, 277, 289, 302, 315, 329, 343, 357, 372, 387, 403, 419, 435, 452, 470, 488, 506, 525, 545, 565, 586, 607, 628, 651, 673, 697, 721, 745, 770, 796, 822, 849, 877, 905, 934, 963, 994, 420, 432, 446, 459, 473, 487, 501, 516, 531, 546, 562, 578, 594, 610, 627, 644, 662, 680, 698, 716, 735, 754, 774, 794, 814, 835, 856
  27. // 160 levels:
  28. // #define PWM1_LEVELS 1, 2, 8, 24, 59, 123, 228, 389, 623, 950, 569, 807, 11, 15, 19, 25, 32, 40, 50, 61, 74, 90, 107, 127, 150, 175, 203, 235, 271, 310, 354, 401, 454, 512, 575, 643, 718, 798, 886, 980, 443, 488, 536, 588, 643, 702, 765, 832, 904, 980, 28, 30, 32, 35, 37, 40, 43, 46, 49, 52, 56, 59, 63, 67, 71, 76, 80, 85, 90, 95, 100, 106, 111, 117, 123, 130, 137, 144, 151, 158, 166, 174, 182, 191, 199, 208, 218, 227, 237, 248, 258, 269, 281, 292, 304, 316, 329, 342, 355, 369, 383, 398, 413, 428, 444, 460, 476, 493, 510, 528, 546, 565, 584, 603, 623, 644, 665, 686, 708, 730, 753, 777, 800, 825, 850, 875, 901, 927, 954, 982, 1010, 425, 437, 450, 462, 475, 487, 501, 514, 528, 541, 556, 570, 585, 599, 615, 630, 646, 662, 678, 694, 711, 728, 745, 763, 780, 799, 817, 836, 856
  29.  
  30. // PWM2_LEVELS - used to set the internal voltage reference for the DAC
  31. // Makes use the of concept of dynamic Vref for higher resolution output
  32. // despite DAC being only 10 bits.
  33. // Bits 2:0 of register ADC0REF set the reference voltage:
  34. // 0x0 - 1.024V - ..000
  35. // 0x1 - 2.048V - ..001
  36. // 0x2 - 4.096V - ..010
  37. // 0x3 - 2.500V- ..011
  38. // 0x5 - VDD - ..101
  39. // 0x6 - VREFA - ..111
  40. // Bit 7 controls if the reference is always on or not.
  41. // Hence set PWM2_LEVELS to be 1xxx000 (0d64) for 1.024V DAC vref (V10)
  42. // set PWM2_LEVELS to be 1xxx011 (0d67) for 2.500V DAC vref (V25)
  43. // Other references are not so important since we have a 10-bit DAC
  44.  
  45. // 150 levels:
  46. #define PWM2_LEVELS V10, V10, V10, V10, V10, V10, V10, V10, V10, V25, V25, V25, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25
  47. // 160 levels:
  48. // #define PWM2_LEVELS V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V25, V25, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V10, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25
  49.  
  50. // Enable usage of multiple power paths
  51. //#define USE_MULTIPLE_POWER_PATH (no longer required, defined in hwdef.c for >2023 Anduril)
  52. #define LED_PATH1_PIN_LEVEL_MIN 1
  53. #define LED_PATH2_PIN_LEVEL_MIN 13
  54. #define LED_PATH3_PIN_LEVEL_MIN 48 // 51 for 160 levels
  55.  
  56. #define HALFSPEED_LEVEL 50
  57. #define QUARTERSPEED_LEVEL 40 // check with TK about the mechanics of this
  58.  
  59. #define DEFAULT_LEVEL 59 // about same as 1 AMC7135, (61 for 160 levels)
  60. #define MAX_1x7135 59 // about same as 1 AMC7135
  61. // MIN_THERM_STEPDOWN defined as MAX_1x7135 in ramp-mode.h if not otherwise defined
  62.  
  63. #define RAMP_SMOOTH_FLOOR 7
  64. #define RAMP_SMOOTH_CEIL 124 // about ~18-20W (Turbo ~40W), (132 for 160 levels)
  65.  
  66. #define RAMP_DISCRETE_FLOOR RAMP_SMOOTH_FLOOR
  67. #define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
  68. #define RAMP_DISCRETE_STEPS 6
  69.  
  70. #define SIMPLE_UI_FLOOR 13
  71. #define SIMPLE_UI_CEIL 112 // about ~12W, (119 for 160 levels)
  72. #define SIMPLE_UI_STEPS 5
  73.  
  74. // don't blink mid-ramp
  75. #ifdef BLINK_AT_RAMP_MIDDLE
  76. #undef BLINK_AT_RAMP_MIDDLE
  77. #endif
  78.  
  79. //***************************************
  80. //** THERMAL SETTINGS **
  81. //***************************************
  82.  
  83. //#define USE_THERMAL_REGULATION
  84.  
  85. // set thermal ceiling
  86.  
  87. //#ifdef DEFAULT_THERM_CEIL
  88. //#undef DEFAULT_THERM_CEIL
  89. //#endif
  90. #define DEFAULT_THERM_CEIL 50
  91.  
  92. // extra boost during turbo, lower when temp = temp_ceil + extra
  93. //#define TURBO_TEMP_EXTRA 0
  94.  
  95. // stop panicking at 6W (not sure of this numbers yet since it depends on the host..)
  96. #define THERM_FASTER_LEVEL 98 // about 6W
  97. #define MIN_THERM_STEPDOWN 62 // similar to single amc7135 in a 3V light
  98. //#define THERM_NEXT_WARNING_THRESHOLD 24 // 24 by default -> increase for fewer adjustments (more stable output on large time scale)
  99. //#define THERM_RESPONSE_MAGNITUDE 64 // 64 by default -> decrease for smaller adjustments (removes dip post turbo)
  100. //#define THERM_WINDOW_SIZE 1 // 2 by default -> decrease for tighter temperature regulation
  101. //#define THERM_LOOKAHEAD 4 // 4 by default -> decrease for longer turbo
  102.  
  103. // easier access to thermal config mode, similar to Emisar, Noctigon
  104. //#define USE_TENCLICK_THERMAL_CONFIG
  105.  
  106. //***************************************
  107. //** USER INTERFACE **
  108. //***************************************
  109.  
  110. //#define SIMPLE_UI_ACTIVE 0 // advanced UI by default
  111.  
  112. // allow Aux Config and Strobe Modes in Simple UI
  113. //#define USE_EXTENDED_SIMPLE_UI
  114.  
  115. // Allow 3C in Simple UI for switching between smooth and stepped ramping
  116. #define USE_SIMPLE_UI_RAMPING_TOGGLE
  117.  
  118. // double click while on goes to full-power turbo, not ramp ceiling
  119. #define DEFAULT_2C_STYLE 1
  120.  
  121. // set this light to use stepped ramp by default (instead of smooth)
  122. #undef RAMP_STYLE
  123. #define RAMP_STYLE 1
  124.  
  125. // uncomment to disable smooth steps
  126. //#ifdef USE_SMOOTH_STEPS
  127. //#undef USE_SMOOTH_STEPS
  128. //#endif
  129.  
  130. #define BLINK_BRIGHTNESS (MAX_LEVEL/5) // increase blink brightness from max/6
  131. #define BLINK_ONCE_TIME 32 // increase from 10 to make brighter
  132.  
  133. //***************************************
  134. //** AUX LEDs and MISC **
  135. //***************************************
  136.  
  137. #define USE_BUTTON_LED
  138.  
  139. // this light has three aux LED channels: R, G, B
  140. #define USE_AUX_RGB_LEDS
  141.  
  142. // show each channel while it scroll by in the menu
  143. #define USE_CONFIG_COLORS
  144.  
  145. // blink numbers on the main LEDs by default
  146. #define DEFAULT_BLINK_CHANNEL CM_MAIN
  147.  
  148. // this light only has one main led channel
  149. // use aux red + aux blue for police strobe
  150. #define USE_POLICE_COLOR_STROBE_MODE
  151. #define POLICE_STROBE_USES_AUX
  152. #define POLICE_COLOR_STROBE_CH1 CM_AUXRED
  153. #define POLICE_COLOR_STROBE_CH2 CM_AUXBLU
  154.  
  155. // the aux LEDs are front-facing, so turn them off while main LEDs are on
  156. #ifdef USE_INDICATOR_LED_WHILE_RAMPING
  157. #undef USE_INDICATOR_LED_WHILE_RAMPING
  158. #endif
  159.  
  160. // RGB aux LEDs should use rainbow cycling mode
  161. // to impress new customers
  162. // (people usually change it to voltage mode later though)
  163. #ifdef RGB_LED_OFF_DEFAULT
  164. #undef RGB_LED_OFF_DEFAULT
  165. #endif
  166. #define RGB_LED_OFF_DEFAULT 0x18 // low, rainbow
  167. #define RGB_LED_LOCKOUT_DEFAULT 0x37 // blinking, rainbow
  168.  
  169. // enable blinking aux LEDs
  170. #define TICK_DURING_STANDBY
  171. #define STANDBY_TICK_SPEED 3 // every 0.128 s
  172. //#define STANDBY_TICK_SPEED 4 // every 0.256 s
  173. //#define STANDBY_TICK_SPEED 5 // every 0.512 s
  174.  
  175. // enable SOS mode
  176. #define USE_SOS_MODE
  177. #define USE_SOS_MODE_IN_BLINKY_GROUP
  178.  
  179. // enable Beacontower blinky mode
  180. #define USE_BEACONTOWER_MODE
  181.  
  182. // party strobe on-time
  183. #define PARTY_STROBE_ONTIME 4
  184. #define STROBE_OFF_LEVEL 1 // keep regulators on between strobes
  185.  
  186. // smoother candle mode with bigger oscillations
  187. #define CANDLE_AMPLITUDE 30 // default 25
  188.  
  189. // avr32dd20 has enough space to smooth out voltage readings
  190. #define USE_VOLTAGE_LOWPASS
  191.  
  192. // can reset the normal way because power is not connected before the button, but do this anyway!
  193. #define USE_SOFT_FACTORY_RESET
  194.  
  195. // enable long-blink as negative sign
  196. #define USE_LONG_BLINK_FOR_NEGATIVE_SIGN
  197.  
  198. // Uncomment to use Microphone mode
  199. //#define USE_MICROPHONE_MODE
  200. //#define MICROPHONE_SCALER 10
  201.  
  202. // ======================================
Advertisement
Add Comment
Please, Sign In to add comment