aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-08-14 11:42:22 +0200
committerlonkaars <loek@pipeframe.xyz>2021-08-14 11:42:22 +0200
commit58f42e278e925bf98530918e5a50bdde91421e28 (patch)
tree637f1bb5c973e00814ce107934ad69669abd57e2 /main
parent4d3a69ffb9423286f33a6f83587c8c83d24f3f2f (diff)
clang-formatHEADmaster
Diffstat (limited to 'main')
-rw-r--r--main/main.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/main/main.c b/main/main.c
index c9d3f54..80e0d4e 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1,5 +1,5 @@
-#include <sys/param.h>
#include <math.h>
+#include <sys/param.h>
#include "esp_event.h"
#include "esp_log.h"
@@ -45,7 +45,7 @@ int transitionc;
int transitioni;
void update_color(int r, int g, int b) {
- for(int i = 0; i < transitionc; i++) {
+ for (int i = 0; i < transitionc; i++) {
float weight2 = (float)(i + 1) / transitionc;
float weight1 = 1 - weight2;
@@ -57,9 +57,12 @@ void update_color(int r, int g, int b) {
}
void update_strip() {
- duties[0] = PWM_PERIOD - (int)( PWM_PERIOD * pow( (float)color[0] / 0xff, BRIGHTNESS_CURVE_CORRECTION ) );
- duties[1] = PWM_PERIOD - (int)( PWM_PERIOD * pow( (float)color[1] / 0xff, BRIGHTNESS_CURVE_CORRECTION ) );
- duties[2] = PWM_PERIOD - (int)( PWM_PERIOD * pow( (float)color[2] / 0xff, BRIGHTNESS_CURVE_CORRECTION ) );
+ duties[0] =
+ PWM_PERIOD - (int)(PWM_PERIOD * pow((float)color[0] / 0xff, BRIGHTNESS_CURVE_CORRECTION));
+ duties[1] =
+ PWM_PERIOD - (int)(PWM_PERIOD * pow((float)color[1] / 0xff, BRIGHTNESS_CURVE_CORRECTION));
+ duties[2] =
+ PWM_PERIOD - (int)(PWM_PERIOD * pow((float)color[2] / 0xff, BRIGHTNESS_CURVE_CORRECTION));
pwm_set_duties(duties);
pwm_start();
}
@@ -159,7 +162,7 @@ void app_main() {
pwm_start();
transitionc = TRANSITION_DURATION_MS / TRANSITION_STEP_LEN_MS;
- transitionv = (int*) malloc(sizeof(int) * transitionc * 3);
+ transitionv = (int *)malloc(sizeof(int) * transitionc * 3);
server = start_webserver();