string strreplace(string original, string toReplace, string replaceWith){
string ret = "";
string left = original;
while (strstr(left, toReplace) >= 0) {
ret += strsub(left, 0, strstr(left, toReplace));
ret += replaceWith;
left = strsub(left, strstr(left, toReplace) + strlen(toReplace));
}
ret += left;
return ret;
}
When you ran into similar:
Make sure that your types of your parameters on the MCU and the host matches...
[ INFO] [1536180410.761324217]: Parameter ~armRotate/minimumPosition requested.
[ INFO] [1536180410.764781574]: Parameter ~armRotate/maximumPosition requested.
[ INFO] [1536180410.769497296]: Parameter ~armRotate/maximumSpeed requested.
[ INFO] [1536180410.774485261]: Parameter ~armRotate/deadBand requested.
[ INFO] [1536180410.778887785]: Parameter ~armRotate/kP requested.
[ INFO] [1536180410.782668712]: Parameter ~armRotate/kI requested.
[ INFO] [1536180410.787019140]: Parameter ~armRotate/kD requested.
[ INFO] [1536180410.790912621]: Parameter ~armRotate/kGain requested.
[ INFO] [1536180410.794231906]: Parameter ~armRotate/iMin requested.
[ WARN] [1536180410.796379771]: Failed to get param: length mismatch
[ INFO] [1536180412.641243188]: [tiva_arm] Comms stat: avg bandwidth in: 49, out: 1060 bytes/s, loops/sec: 39230.
[ INFO] [1536180415.798788003]: Parameter ~armRotate/minimumPosition requested.
[ INFO] [1536180415.803152207]: Parameter ~armRotate/maximumPosition requested.
[ INFO] [1536180415.807883058]: Parameter ~armRotate/maximumSpeed requested.
[ INFO] [1536180415.811802805]: Parameter ~armRotate/deadBand requested.
[ INFO] [1536180415.815071212]: Parameter ~armRotate/kP requested.
[ INFO] [1536180415.818853175]: Parameter ~armRotate/kI requested.
[ INFO] [1536180415.821947062]: Parameter ~armRotate/kD requested.
[ INFO] [1536180415.824762202]: Parameter ~armRotate/kGain requested.
[ INFO] [1536180415.827612723]: Parameter ~armRotate/iMin requested.
[ WARN] [1536180415.830237542]: Failed to get param: length mismatch
Make sure that your types of your parameters on the MCU and the host matches...
One of our custom analyzer plugin started to fail to load after started using an std::set variable with the error above with the similar output from the Logic:
Solution:
Add -lc++ to the linker flags before the -lAnalyzer.
Starting /Applications/Logic.app/Contents/MacOS/Logic...
exe File path is /Applications/Logic.app/Contents/MacOS/Logic [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 260 ]
exe folder path is /Applications/Logic.app/Contents/MacOS [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 261 ]
Release Mode; analyzer path is /Applications/Logic.app/Contents/Resources/Analyzers [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 283 ]
Release Mode; exe path is /Applications/Logic.app/Contents/MacOS; user path is /Users/Miklos [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 318 ]
Found log directory at Library//Logs//DiagnosticReports [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 327 ]
dlopen fail (null) [ /Users/build/ob_logic/Source/AnalyzerManager.cpp; LoadAnalyzersAtPath; 159 ]
dlopen fail dlopen(/Users/Miklos/git/saleae_xline_analyzer/bin/libXLiNEAnalyzer.1.0.dylib, 1): Symbol not found: __ZTISt12out_of_range
Referenced from: /Users/Miklos/git/saleae_xline_analyzer/bin/libXLiNEAnalyzer.1.0.dylib
Expected in: /Applications/Logic.app/Contents/MacOS/../MacOS/libAnalyzer.dylib
Solution:
Add -lc++ to the linker flags before the -lAnalyzer.
I have converted a project previously built with Cosmic to be compiled with SDCC.
The size results were really bad, the project cannot fit in the 8K memory of the STM8S003:
SDCC:
While Cosmic:
The total flash size is just 6912 bytes because of the bootloader.
The size results were really bad, the project cannot fit in the 8K memory of the STM8S003:
SDCC:
flash size: 6912 occupied: 8706 (125.95%) free: -1794 (-25.95%)
sensor size: 2092 (30.27%)
interrupt size: 1959 (28.34%)
signalprocessing size: 1577 (22.82%)
xlineslave size: 1309 (18.94%)
led size: 988 (14.29%)
init size: 253 (3.66%)
config size: 129 (1.87%)
delay size: 123 (1.78%)
seedbuffers size: 104 (1.50%)
main size: 86 (1.24%)
adc size: 86 (1.24%)
While Cosmic:
flash size: 6912 occupied: 6480 (93.75%) free: 432 (6.25%)
interrupt.o size: 1540 (22.28%)
sensor.o size: 1464 (21.18%)
xlineslave.o size: 802 (11.60%)
signalprocessing.o size: 688 (9.95%)
led.o size: 559 (8.09%)
ldiv.o size: 235 (3.40%)
init.o size: 222 (3.21%)
lmul.o size: 139 (2.01%)
config.o size: 131 (1.90%)
interrupt_vectors.o size: 128 (1.85%)
crtsi0.sm size: 80 (1.16%)
delay.o size: 73 (1.06%)
main.o size: 69 (1.00%)
adc.o size: 60 (0.87%)
seedbuffers.o size: 45 (0.65%)
imul.o size: 33 (0.48%)
lcmp.o size: 32 (0.46%)
lgadd.o size: 23 (0.33%)
lsbc.o size: 23 (0.33%)
lneg.o size: 21 (0.30%)
cmulx.o size: 20 (0.29%)
ludiv.o size: 20 (0.29%)
lgneg.o size: 19 (0.27%)
rtol.o size: 18 (0.26%)
lursh.o size: 15 (0.22%)
lgursh.o size: 14 (0.20%)
utolx.o size: 7 (0.10%)
The total flash size is just 6912 bytes because of the bootloader.
One of my friend bought a similar 5 pack of 150mAh LiPo batteries + 5 output USB charger from ebay for his Furibee F36:
![](images/s-l400.jpg)
He told me that the batteries bought with it start loosing their capacity after a short period.
He also noticed that the charger charged pretty quickly the at the first cycles too.
After tearing apart the charger we figured out that reason for both thing (the degradation and the fast charge):
There are 5 individual chargers on the PCB built around the LTC4045 IC.
![](images/P5190001.JPG)
The charging current is controlled by a resistor which was 2700 Ohm in the board.
If we look into the datasheet we find the equation of the charging current:
![](images/Screenshot_20180519_224907.png)
As you can calculate the charging current is set to 1000V/2700Ohm == 370 mA. In the case of a 150mAh battery the charging current is ~2.5C which is pretty high. Usually it is recommended to charge with maximum 1C these batteries.
1C gives us 1000/0.150 == 6666Ohm for prog resistor. It is not so common resistor, so a 6800Ohm (charge current == 147mAh)should fit well.
We wish your batteries long life!
![](images/s-l400.jpg)
He told me that the batteries bought with it start loosing their capacity after a short period.
He also noticed that the charger charged pretty quickly the at the first cycles too.
After tearing apart the charger we figured out that reason for both thing (the degradation and the fast charge):
There are 5 individual chargers on the PCB built around the LTC4045 IC.
The charging current is controlled by a resistor which was 2700 Ohm in the board.
If we look into the datasheet we find the equation of the charging current:
![](images/Screenshot_20180519_224907.png)
As you can calculate the charging current is set to 1000V/2700Ohm == 370 mA. In the case of a 150mAh battery the charging current is ~2.5C which is pretty high. Usually it is recommended to charge with maximum 1C these batteries.
1C gives us 1000/0.150 == 6666Ohm for prog resistor. It is not so common resistor, so a 6800Ohm (charge current == 147mAh)should fit well.
We wish your batteries long life!