Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor updates per review
  • Loading branch information
david-cermak committed Jul 4, 2018
commit ab4ffbc05fb356edf4094044a687f58ad88843e6
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

#include "esp32-hal.h"

#define LED_MATRIX_SIZE 8*4*24
#define NR_OF_LEDS 8*4
#define NR_OF_PIXELS 24*NR_OF_LEDS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be number of bits. each led is a pixel


//
// Note: This example uses Neopixel LED board, 32 LEDs chained one
Expand All @@ -32,12 +33,10 @@
// +-------------+ +--
// | 0.8us | 0.4us |

rmt_data_t led_data[LED_MATRIX_SIZE];
rmt_data_t led_data[NR_OF_PIXELS];

rmt_obj_t* rmt_send = NULL;

static EventGroupHandle_t events;

void setup()
{
Serial.begin(115200);
Expand All @@ -58,27 +57,27 @@ int led_index = 0;
void loop()
{
// Init data with only one led ON
int i;
int item, bit, inx;
for (i=0; i<LED_MATRIX_SIZE; i++) {

item = i/24;

bit = i%8;
inx = i/8;

if ( (color[inx%3] & (1<<(8-bit))) && (item == led_index) )
led_data[i].val = 0x80070006;
else
led_data[i].val = 0x80040008;
int led, col, bit;
int i=0;
for (led=0; led<NR_OF_LEDS; led++) {
for (col=0; col<3; col++ ) {
for (bit=0; bit<8; bit++){
if ( (color[col] & (1<<(8-bit))) && (led == led_index) ) {
led_data[i].val = 0x80070006;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this value? please use the struct fields

} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values are different,. a direct conversion between the .val and fields would be

led_data[i].level0 = 1; led_data[i].duration0 = 7; led_data[i].level1 = 0; led_data[i].duration1 = 6;

Did you want to change the values?

Chuck

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you chuck, good catch!

Indeed I meant to update the values (to be in line with the diagrams), but not that much. wanted to use pulses 8/4 instead of 7/6 (the led's are quite tolerant so it's accepted)

led_data[i].val = 0x80040008;
}
i++;
}
}
}
// make the led travel in the pannel
if ((++led_index)>=4*8) {
if ((++led_index)>=NR_OF_LEDS) {
led_index = 0;
}

// Send the data
rmtWrite(rmt_send, led_data, LED_MATRIX_SIZE);
rmtWrite(rmt_send, led_data, NR_OF_PIXELS);

delay(100);
}