Zatraceny Ccko

hwnews konference hwnews na cncnet.info
Úterý Říjen 31 12:35:46 CET 2017


No ja tak nejak predpokladal, ze trida String je built-in ....hmm takze neni

Dne 31. října 2017 12:33 Petr Zapadlo <zapik na email.cz> napsal(a):

> Zase jsem se v TB uklikl :-)
>
> Správná funkce je:
>
> https://www.arduino.cc/en/Reference/StringToCharArray
>
> předpokládám, že to Radek páchá v Arduino frameworku.
>
> Petr
>
>
> Dne 31. 10. 17 v 12:30 Jindroush napsal(a):
>
> Pouzivate nejakou tridu String a posilate ji nekam, kde to vyzaduje const
>> char*, tj. ceckovy string.
>> Prozkoumejte tu tridu, urcite je v ni nejaka member funkce, ktera vraci
>> ten string, treba rv_text.c_str() (ale to jen hadam)
>>
>> J.
>>
>> On 31.10.2017 12:11, hwnews konference wrote:
>>
>>> Zdravim,
>>>
>>> delam si ten palubni budik na lod s  e-ink displejem a ESP32. Ohybam
>>> nejake knihovny, ktere jsou v examplech...na displej uz kreslim, web mi
>>> take jede, ale zasekl jsem se na pro me nepochopitelne definici procedury:
>>>
>>> void DrawStringAt(int x, int y, const char* text, sFONT* font, int
>>> colored);
>>>
>>> ja jsem tu deklaraci puvodne nezkoumal, protoze primo vlozeny string
>>> jako parametr fungoval
>>>
>>> Kdyz jsem to ale chtel pouzit takto tak jsem si nabehnul:
>>>
>>> for (uint8_t i=0; i<server.args(); i++){
>>>      rv_text =  server.argName(i) + ": " + server.arg(i);
>>>      message += " " + rv_text+ "\n";
>>>      paint.DrawStringAt(0, 0, rv_text, &Font8, UNCOLORED);
>>>      epd.SetPartialWindow(paint.GetImage(), 0, 20+(i*12),
>>> paint.GetWidth(), paint.GetHeight());
>>>    }
>>>
>>>
>>> void DrawStringAt(int x, int y, const char* text, sFONT* font, int
>>> colored);
>>>                                                             ^
>>> epdpaint.h:56:10: note:   no known conversion for argument 3 from
>>> 'String' to 'const char*'
>>>
>>> cela ta procedura je napsana takto:
>>>
>>> void Paint::DrawStringAt(int x, int y, const char* text, sFONT* font,
>>> int colored) {
>>>      const char* p_text = text;
>>>      unsigned int counter = 0;
>>>      int refcolumn = x;
>>>      /* Send the string character by character on EPD */
>>>      while (*p_text != 0) {
>>>          /* Display one character on EPD */
>>>          DrawCharAt(refcolumn, y, *p_text, font, colored);
>>>          /* Decrement the column position by 16 */
>>>          refcolumn += font->Width;
>>>          /* Point on the next character */
>>>          p_text++;
>>>          counter++;
>>>      }
>>> }
>>>
>>> Jak by se to melo upravit abyto bylo koser?
>>>
>>> RV
>>>
>>>
>>> _______________________________________________
>>> HW-list mailing list  -  sponsored by www.HW.cz
>>> Hw-list na list.hw.cz
>>> http://list.hw.cz/mailman/listinfo/hw-list
>>>
>>>
>>
>>
> _______________________________________________
> HW-list mailing list  -  sponsored by www.HW.cz
> Hw-list na list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list
>
------------- další část ---------------
HTML příloha byla odstraněna...
URL: <http://list.hw.cz/pipermail/hw-list/attachments/20171031/5f585647/attachment-0001.html>


Další informace o konferenci Hw-list