raiseArgumentTypeError('Breathing center must be between 1 and 2.7')
defbreathing_max(value):
value=int(value)
ifvalueinrange(0,256):
returnvalue
else:
raiseArgumentTypeError('Breathing max must be between 0 and 255')
@cli.argument('-c','--center',arg_only=True,type=breathing_center,default=1.85,help='The breathing center value, from 1 to 2.7. Default: 1.85')
@cli.argument('-m','--max',arg_only=True,type=breathing_max,default=255,help='The breathing maximum value, from 0 to 255. Default: 255')
@cli.argument('-o','--output',arg_only=True,type=qmk.path.normpath,help='File to write to')
@cli.argument('-q','--quiet',arg_only=True,action='store_true',help='Quiet mode, only output error messages')
@cli.subcommand('Generates an RGB Light breathing table header.')
defgenerate_rgb_breathe_table(cli):
"""Generate a rgblight_breathe_table.h file containing a breathing LUT for RGB Lighting (Underglow) feature.
"""
breathe_values=[0]*256
forposinrange(0,256):
breathe_values[pos]=(int)((math.exp(math.sin((pos/255)*math.pi))-cli.args.center/math.e)*(cli.args.max/(math.e-1/math.e)))# noqa: yapf insists there be no whitespace around /