whycomeimsocool

Untitled

Feb 7th, 2025 (edited)
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.22 KB | None | 0 0
  1. hw/loneoceans/lume-x1-40w/anduril.h
  2.  
  3. (model 4211)
  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-40W **
  12. //*********************************************
  13.  
  14. #define HWDEF_H loneoceans/lume-x1-40w/hwdef.h
  15.  
  16. //***************************************
  17. //** RAMP TABLE AND OPERATIONS **
  18. //***************************************
  19.  
  20. #define RAMP_SIZE 150
  21.  
  22. // PWM1: DAC Data
  23. // UDR x^4 curves specifically for Lume X1
  24. #define PWM1_LEVELS 1, 2, 4, 8, 18, 37, 69, 117, 188, 143, 210, 218, 180, 242, 11, 15, 19, 23, 29, 36, 43, 52, 62, 74, 87, 102, 118, 137, 157, 180, 205, 233, 132, 148, 167, 187, 208, 232, 188, 209, 230, 253, 167, 183, 200, 219, 239, 255, 13, 14, 15, 16, 17, 19, 20, 22, 23, 25, 27, 29, 31, 33, 35, 37, 39, 42, 45, 47, 50, 53, 56, 60, 63, 66, 70, 74, 78, 82, 87, 91, 96, 101, 106, 111, 116, 122, 128, 134, 140, 146, 153, 160, 167, 175, 182, 190, 198, 207, 215, 224, 233, 243, 253, 131, 137, 142, 147, 153, 159, 165, 171, 177, 184, 190, 197, 204, 212, 219, 227, 234, 243, 251, 190, 196, 203, 210, 216, 223, 231, 238, 245, 253, 157, 161, 166, 171, 177, 182, 187, 193, 198, 204, 210, 216, 222, 229, 235, 242, 248, 255
  25.  
  26. // PWM2_LEVELS - used to set the internal voltage reference for the DAC
  27. // Makes use the of concept of dynamic Vref for higher resolution output
  28. // despite DAC being only 8 bits.
  29. // See Page 165 of datasheet: https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/ATtiny1614-16-17-DataSheet-DS40002204A.pdf
  30. // Bits 2:0 of register VREF.CTRLA are for DAC0 reference:
  31. // 0x0 - 0.55V - ..000
  32. // 0x1 - 1.1V - ..001
  33. // 0x2 - 2.5V - ..010
  34. // 0x3 - 4.3V - ..011
  35. // 0x4 - 1.5V - ..100
  36. // Bits 6:4 of register VREF.CTRLA are for ADC0 reference:
  37. // We can set this to be 0x2 for 2.5V reference
  38. // Hence set PWM2_LEVELS to be 10000 (0d16) for 0.55V DAC vref (V05/V055)
  39. // set PWM2_LEVELS to be 10001 (0d17) for 1.1V DAC vref (V11)
  40. // set PWM2_LEVELS to be 10100 (0d20) for 1.5V DAC vref (V15)
  41. // set PWM2_LEVELS to be 10010 (0d18) for 2.5V DAC vref (V25)
  42. // VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20)
  43. #define PWM2_LEVELS V05, V05, V05, V05, V05, V05, V05, V05, V05, V11, V11, V15, V25, V25, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V11, V11, V11, V11, V11, V11, V15, V15, V15, V15, V25, V25, V25, V25, V25, V25, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V05, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V11, V15, V15, V15, V15, V15, V15, V15, V15, V15, V15, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25, V25
  44.  
  45. // Enable usage of multiple power paths
  46. //#define USE_MULTIPLE_POWER_PATH (no longer required, defined in hwdef.c for >2023 Anduril2)
  47. #define LED_PATH1_PIN_LEVEL_MIN 1
  48. #define LED_PATH2_PIN_LEVEL_MIN 15
  49. #define LED_PATH3_PIN_LEVEL_MIN 49
  50. #define LED_FET_PIN_LEVEL_MIN 150 // Not used for Lume X1
  51.  
  52. #define HALFSPEED_LEVEL 52
  53. #define QUARTERSPEED_LEVEL 47 // double check with TK about the mechanics of this
  54.  
  55. #define DEFAULT_LEVEL 52 // ~0.5W
  56. #define MAX_1x7135 63 // ~1.05W
  57. // MIN_THERM_STEPDOWN defined as MAX_1x7135 in ramp-mode.h if not otherwise defined
  58.  
  59. #define RAMP_SMOOTH_FLOOR 8 // ~0.04 lumens M2?
  60. #define RAMP_SMOOTH_CEIL 125 // ~18-20W
  61.  
  62. #define RAMP_DISCRETE_FLOOR RAMP_SMOOTH_FLOOR
  63. #define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
  64. #define RAMP_DISCRETE_STEPS 6
  65.  
  66. #define SIMPLE_UI_FLOOR 16 // ~0.13 lumens M2?
  67. #define SIMPLE_UI_CEIL 113 // ~12W
  68. #define SIMPLE_UI_STEPS 5
  69.  
  70. // Turn on DC/DC converter enable pin
  71. // For Lume1 - turn on from level 1-149 but not 150
  72. // For Lume X1 - turn on from all levels 1-150
  73. //#define LED_ENABLE_PIN_LEVEL_MIN 1
  74. //#define LED_ENABLE_PIN_LEVEL_MAX 150
  75.  
  76. // don't blink mid-ramp
  77. #ifdef BLINK_AT_RAMP_MIDDLE
  78. #undef BLINK_AT_RAMP_MIDDLE
  79. #endif
  80.  
  81. //***************************************
  82. //** THERMAL SETTINGS **
  83. //***************************************
  84.  
  85. // set thermal ceiling
  86. #ifdef DEFAULT_THERM_CEIL
  87. #undef DEFAULT_THERM_CEIL
  88. #endif
  89. #define DEFAULT_THERM_CEIL 50
  90.  
  91. // stop panicking at ~1.5A (not sure of this numbers yet since it depends on the host..)
  92. #define THERM_FASTER_LEVEL 106 // ~8.8W
  93. #define MIN_THERM_STEPDOWN 63 // ~1.05W
  94. #define THERM_NEXT_WARNING_THRESHOLD 16 // 24 by default -> increase for fewer adjustments (more stable output on large time scale)
  95. #define THERM_RESPONSE_MAGNITUDE 32 // 64 by default -> decrease for smaller adjustments (removes dip post turbo)
  96. //#define THERM_WINDOW_SIZE 1 // 2 by default -> decrease for tighter temperature regulation
  97. //#define THERM_LOOKAHEAD 4 // 4 by default -> decrease for longer turbo
  98.  
  99. // easier access to thermal config mode, similar to Emisar, Noctigon
  100. //#define USE_TENCLICK_THERMAL_CONFIG
  101.  
  102. //***************************************
  103. //** USER INTERFACE **
  104. //***************************************
  105.  
  106. //#define SIMPLE_UI_ACTIVE 0 // advanced UI by default
  107.  
  108. // allow Aux Config and Strobe Modes in Simple UI
  109. //#define USE_EXTENDED_SIMPLE_UI
  110.  
  111. // Allow 3C in Simple UI for switching between smooth and stepped ramping
  112. #define USE_SIMPLE_UI_RAMPING_TOGGLE
  113.  
  114. #define DEFAULT_2C_STYLE 1 // enable 2 click turbo
  115.  
  116. // set this light to use stepped ramp by default (instead of smooth)
  117. #undef RAMP_STYLE
  118. #define RAMP_STYLE 1
  119.  
  120. // uncomment to disable smooth steps
  121. //#ifdef USE_SMOOTH_STEPS
  122. //#undef USE_SMOOTH_STEPS
  123. //#endif
  124.  
  125. #define BLINK_BRIGHTNESS (MAX_LEVEL/4) // increase blink brightness from max/6
  126. #define BLINK_ONCE_TIME 32 // increase from 10 to make brighter
  127.  
  128. //***************************************
  129. //** AUX LEDs and MISC **
  130. //***************************************
  131.  
  132. #define USE_BUTTON_LED
  133.  
  134. // this light has three aux LED channels: R, G, B
  135. #define USE_AUX_RGB_LEDS
  136.  
  137. // show each channel while it scroll by in the menu
  138. #define USE_CONFIG_COLORS
  139.  
  140. // blink numbers on the main LEDs by default
  141. #define DEFAULT_BLINK_CHANNEL CM_MAIN
  142.  
  143. // this light only has one main led channel
  144. // use aux red + aux blue for police strobe
  145. #define USE_POLICE_COLOR_STROBE_MODE
  146. #define POLICE_STROBE_USES_AUX
  147. #define POLICE_COLOR_STROBE_CH1 CM_AUXRED
  148. #define POLICE_COLOR_STROBE_CH2 CM_AUXBLU
  149.  
  150. // the aux LEDs are front-facing, so turn them off while main LEDs are on
  151. #ifdef USE_INDICATOR_LED_WHILE_RAMPING
  152. #undef USE_INDICATOR_LED_WHILE_RAMPING
  153. #endif
  154.  
  155. // RGB aux LEDs should use rainbow cycling mode
  156. // to impress new customers
  157. // (people usually change it to voltage mode later though)
  158. #ifdef RGB_LED_OFF_DEFAULT
  159. #undef RGB_LED_OFF_DEFAULT
  160. #endif
  161. #define RGB_LED_OFF_DEFAULT 0x18 // low, rainbow
  162. #define RGB_LED_LOCKOUT_DEFAULT 0x37 // blinking, rainbow
  163.  
  164. // enable blinking aux LEDs
  165. #define TICK_DURING_STANDBY
  166. #define STANDBY_TICK_SPEED 3 // every 0.128 s
  167. //#define STANDBY_TICK_SPEED 4 // every 0.256 s
  168. //#define STANDBY_TICK_SPEED 5 // every 0.512 s
  169.  
  170. // enable SOS mode
  171. #define USE_SOS_MODE
  172. #define USE_SOS_MODE_IN_BLINKY_GROUP
  173.  
  174. // enable Beacontower blinky mode
  175. #define USE_BEACONTOWER_MODE
  176.  
  177. // party strobe on-time
  178. #define PARTY_STROBE_ONTIME 4
  179. #define STROBE_OFF_LEVEL 1 // keep regulators on between strobes
  180.  
  181. // smoother candle mode with bigger oscillations
  182. #define CANDLE_AMPLITUDE 30 // default 25
  183.  
  184. // attiny1616 has enough space to smooth out voltage readings
  185. #define USE_VOLTAGE_LOWPASS
  186.  
  187. // can reset the normal way because power is not connected before the button, but do this anyway!
  188. #define USE_SOFT_FACTORY_RESET
  189.  
  190. // enable long-blink as negative sign
  191. #define USE_LONG_BLINK_FOR_NEGATIVE_SIGN
  192.  
  193. // enable OTG mode in momentary mode
  194. #define USE_OTG_IN_MOMENTARY
  195.  
  196. // Uncomment to use Microphone mode
  197. //#define USE_MICROPHONE_MODE
  198. //#define MICROPHONE_SCALER 10
  199.  
  200. // ======================================
Advertisement
Add Comment
Please, Sign In to add comment