forked from PAWPAW/lib_rgb
修正了测试中的定义,现在可以正确更改灯的数量
This commit is contained in:
@@ -2,15 +2,14 @@
|
||||
#include <stdio.h> // 包含基本的输入输出函数
|
||||
#include <platform.h> // 包含对封装的定义,引用以使用 on tile[] 语法
|
||||
#include "samples_to_levels.h"
|
||||
#define NUM_RGB_GROUPS 3
|
||||
#include "rgb_effect.h"
|
||||
#include "timer.h"
|
||||
|
||||
void test_fill_gradient_with_groups()
|
||||
{
|
||||
uint32_t buffer[NUM_RGBS];
|
||||
uint32_t colors[] = {0xFF0000, 0x00FF00}; // 红,绿
|
||||
size_t num_filled_rgb[] = {2, 3}; // 每组填充数量
|
||||
size_t num_groups = sizeof(colors) / sizeof(colors[0]);
|
||||
uint32_t colors[] = {0xFF0000, 0x00FF00, 0x0000FF}; // 红,绿,蓝
|
||||
size_t num_filled_rgb[] = {4, 4, 4}; // 每组填充数量
|
||||
int success = 1; // 使用int代替bool,1代表true,0代表false
|
||||
|
||||
fill_gradient_with_groups(buffer, colors, num_filled_rgb);
|
||||
@@ -19,8 +18,8 @@ void test_fill_gradient_with_groups()
|
||||
// 验证
|
||||
for (size_t i = 0; i < NUM_RGBS; i++)
|
||||
{
|
||||
size_t group = i / (NUM_RGBS / num_groups);
|
||||
size_t group_led_start = group * (NUM_RGBS / num_groups);
|
||||
size_t group = i / (NUM_RGBS / NUM_RGB_GROUPS);
|
||||
size_t group_led_start = group * (NUM_RGBS / NUM_RGB_GROUPS);
|
||||
uint32_t expected_color = (i < group_led_start + num_filled_rgb[group]) ? colors[group] : 0x000000;
|
||||
if (buffer[i] != expected_color)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user