mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 13:22:19 +01:00
test commit for separating string by comma
This commit is contained in:
@@ -77,13 +77,21 @@ void DynamicLamp::set_save_mode(uint8_t save_mode) {
|
|||||||
this->save_mode_ = save_mode;
|
this->save_mode_ = save_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicLamp::set_available_outputs(std::list<std::string> output_list) {
|
void DynamicLamp::set_available_outputs(std::string output_list) {
|
||||||
uint8_t i = 0;
|
int counter = 0;
|
||||||
for (std::list<std::string>::iterator it = output_list.begin(); it != output_list.end(); ++it) {
|
std::vector<std::string> v;
|
||||||
this->available_outputs_[i] = *it;
|
|
||||||
i++;
|
char * token = strtok (&output_list[0],",");
|
||||||
|
while (token != NULL)
|
||||||
|
{
|
||||||
|
v.push_back(token);
|
||||||
|
token = strtok (NULL, ",");
|
||||||
|
}
|
||||||
|
for ( std::string s : v )
|
||||||
|
{
|
||||||
|
this->available_outputs_[counter] = s.c_str();
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void DynamicLamp::set_lamp_count(uint8_t lamp_count) {
|
void DynamicLamp::set_lamp_count(uint8_t lamp_count) {
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include <list>
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace dynamic_lamp {
|
namespace dynamic_lamp {
|
||||||
@@ -38,7 +37,7 @@ class DynamicLamp : public Component {
|
|||||||
void loop() override;
|
void loop() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
void set_lamp_count(uint8_t lamp_count);
|
void set_lamp_count(uint8_t lamp_count);
|
||||||
void set_available_outputs(std::list<std::string> output_list);
|
void set_available_outputs(std::string output_list);
|
||||||
void set_save_mode(uint8_t save_mode);
|
void set_save_mode(uint8_t save_mode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Reference in New Issue
Block a user