#avr Logs

Jun 30 2017

#avr Calendar

12:22 AM day_ is now known as daey
01:51 AM julius: hi
01:52 AM julius: i would like to use a char array of arrays to save the conversion from itoa (integer -> char)
01:52 AM julius: i know that itoa wants a char pointer as target
01:53 AM julius: oh wait...one more google search
01:55 AM julius: for (uint8_t n=0; n<sizeof(time); n++) {
01:55 AM julius: itoa(time[n], output[n], 10);
01:55 AM julius: }
01:55 AM julius: for (uint8_t n=0; n<sizeof(time); n++) { itoa(time[n], output[n], 10); } this is what i would use
01:57 AM julius: do i need to add pointer crap to this to access the arrays, or is output[1] for example the second array?
01:58 AM julius: time is a one dimensional array of uint8_tvuint8_t time[] = {0, 15, 9, 3, 12, 4, 17};
01:58 AM julius: man youre late, sun is already up here ;)
03:17 AM Emil: You want to convert data in integer** to char**?
03:26 AM julius: no
03:26 AM julius: that paste was bad
03:27 AM julius: uint8_t time[] = {0, 15, 9, 3, 12, 4, 17};
03:27 AM julius: morning btw :)
03:44 AM Emil: you want integer* to char**?
03:47 AM Emil: then yeah you call it in a loop with itoa(time[n], output[n], len); where output was declared as char **output or perhaps char[length][size]
03:47 AM Emil: depending on how you memory manage
03:59 AM julius: i did choose the second one, char[length][size]
03:59 AM julius: is char[length][size] == char[row][column] ?
04:00 AM Emil: yes
04:00 AM julius: nice
04:00 AM Emil: it is just a continuous block of memory
04:00 AM julius: on a pc i would have tested this....but im not sure what else could go wrong and error hunting these things can be nerve killing on a avr
05:26 AM julius: ah, finally i can control time
05:28 AM julius: anybody got some bash code that gets the current date and time and sets it in a .c file before the chip is programmed?
05:29 AM julius: everytime i reprogram the avr it gets the last date/time that i set in the source
05:29 AM julius: for the rtc
05:29 AM Emil: you mean
05:30 AM julius: or a sed command
05:31 AM Emil: sed -i "s/CURRENTDATE/$(date '+%F %T %z')/g" file
05:32 AM Emil: Yeah that works
05:32 AM Emil: so you can do something like #define CURRENTDAY REPLACETHISWITHCURRENTDAY
05:33 AM Emil: and then
05:33 AM Emil: sed -i "s/REPLACETHISWITHCURRENTDAY/$(date '+%F %T %z')/g" file
05:33 AM Emil: et ceterea
05:45 AM daey: et cetera id est. *cnr* ^_^"
05:57 AM Thrashbarg: Quidquid latine dictum sit, altum viditur.
06:41 AM julius: Emil: youre great
06:41 AM julius: gonna try that later
06:46 AM Emil: julius: np
07:40 AM twnqx: julius: personally i use an autogenerated version.h that also auto-increments build numbers :P
07:43 AM polprog: thats a good idea
07:53 AM noHitW_work: im gonna build a radio with my friend who is a wood designer
07:54 AM noHitW_work: any suggestions for the hardware?
07:55 AM Lambda_Aurigae: a diode, a variable capacitor, a coil, two transistors, 3 resistors, a 9V battery, and an 8ohm speaker.
07:56 AM Lambda_Aurigae: well,,and a couple more capacitors.
07:56 AM Lambda_Aurigae: http://www.homemade-circuits.com/2012/10/simplest-am-radio-receiver-with-speaker.html
07:57 AM Lambda_Aurigae: and that one doesn't even use a diode!
07:58 AM noHitW_work: the case is gonna be old school style, but not the electronics
07:58 AM Lambda_Aurigae: http://www.electroschematics.com/601/2-transistor-radio-receiver/
07:58 AM Lambda_Aurigae: oh.
07:59 AM Lambda_Aurigae: you said radio..you didn't specify what frequency range or anything.
07:59 AM noHitW_work: there must be radio station store option
07:59 AM Lambda_Aurigae: red marker on the front panel where the tuning dial is.
07:59 AM noHitW_work: and some sort of display
08:00 AM Lambda_Aurigae: get a car radio and put it in the box.
08:00 AM noHitW_work: hmm
08:00 AM Lambda_Aurigae: that's how we used to build boom boxes when I was a kid.
08:01 AM noHitW_work: yeah, but its not gonna work now
08:01 AM Lambda_Aurigae: car radio, some speakers, a motorcycle battery, and a small battery charger with a good filter.
08:01 AM Lambda_Aurigae: mount it all in a milk crate and away you go!
08:01 AM Lambda_Aurigae: anyhoo..time to go do w*rk!
08:05 AM noHitW_work: Emil have you ordered anything from adafruit?
08:05 AM noHitW_work: how are the shipping costs to finland and how long does it usually take?
08:05 AM noHitW_work: +much
08:06 AM noHitW_work: there's some cool BT stuff i need from there
08:07 AM Emil: noHitW_work: adafruit is expensive as fuck
08:07 AM Emil: And everything they sell I can get cheaper from china
08:07 AM noHitW_work: that doesnt matter to me
08:08 AM Emil: but yeah they ship quite fast
08:09 AM noHitW_work: https://www.adafruit.com/product/1697 https://www.adafruit.com/product/2269 https://www.adafruit.com/product/2267
08:09 AM noHitW_work: i want these
08:21 AM polprog: theese have those cool ceramic antennas
08:33 AM Emil: noHitW_work: You can just add them to card and check the shipping costs
08:33 AM Emil: timewise it depends on what shipping method they have
08:33 AM noHitW_work: ok
08:34 AM Emil: if it's a courier that you pay for (quite a lot) then it's like less than a week
08:34 AM noHitW_work: cant order yet, wednesday is the payday
08:34 AM Emil: if it's cheap as fuck then it can take that month
08:34 AM noHitW_work: im gonna order a shit ton of electronics
08:34 AM polprog: adafruit ships from the U.S.?
08:35 AM Emil: polprog: yeah
08:35 AM Emil: noHitW_work: check exp-tech.de
08:35 AM noHitW_work: i have used that
08:35 AM noHitW_work: bought raspi from there
08:35 AM Emil: They "resell" adafruit things
08:35 AM polprog: fuck, i tried to order some keycaps from the us, they wanted 200$ for a tracked parcel :D
08:35 AM Emil: I think they are like a distributor
08:35 AM Emil: polprog: not suprised in the least
08:35 AM noHitW_work: ok good to know
08:37 AM polprog: Emil: thx, that site (exp-tech) has a nice stock
08:37 AM polprog: :)
08:46 AM Emil: That they do
08:46 AM noHitW_work: where can you get these esp8266 modules?
08:46 AM noHitW_work: from china?
08:46 AM Emil: Adafruit also sells them
08:46 AM Emil: ESP-12S
08:46 AM Emil: It's also fcc approved
08:46 AM Emil: but otherwise chink shit stores
08:47 AM noHitW_work: ok
08:47 AM Emil: Aliexpress/eBay/Banggood/whatever
08:49 AM noHitW_work: im gonna put esp8266 in that radio
08:52 AM Emil: Sounds good
08:53 AM noHitW_work: "Espruino 1.4 - Open Source Javascript Microcontroller" :D
08:53 AM noHitW_work: why
08:54 AM Emil: because "Hey let's put javashit _EVERYWHERE_"
08:54 AM Emil: Though I do admit that programming in javascript is quite pleasant
08:54 AM Emil: You get results quickly, the syntax is C-like (with classes)
08:55 AM noHitW_work: its ok
08:56 AM noHitW_work: but i like java these days, as a second language
08:57 AM noHitW_work: i like it a lot actually, used to hate it
08:58 AM noHitW_work: programming android is quite nice when you get the to konw it better
08:59 AM noHitW_work: and you can do modules with C/C++
09:01 AM Emil: Java should burn in hell
09:05 AM noHitW_work: java doesnt have unsigned ints/shorts/bytes so it makes handling byte arrays a pain when you have to calculate checksums
09:07 AM LeoNerd: Presumably at some point it's easier to delegate out to a little bit of C code you JNI'ed into it
09:07 AM noHitW_work: yeah
09:12 AM noHitW_work: int i = b & 0xFF; <-this is what you have to do for every byte if wanna calucalte a checksum from array of bytes
09:13 AM Emil: but
09:13 AM Emil: why
09:13 AM Emil: :D
09:13 AM cehteh: mhm?
09:13 AM Emil: what does it do otherwise?
09:14 AM noHitW_work: if its above 128, its a negative number
09:14 AM cehteh: just use unsigned math on such things
09:14 AM noHitW_work: so it fucks up the calculation
09:15 AM Emil: Holy shit that's retarded
09:15 AM cehteh: (who ever had the idea to define logic operators for signed types :D)
09:15 AM Emil: on the level of javashit "everything is a double"
09:16 AM rue_house: if you dont want signed data, why aren't you using an unsigned data type?
09:16 AM rue_house: would you use a signed number for a voting machine too?
09:16 AM noHitW_work: you guys cant read?
09:17 AM noHitW_work: the whole point was that java doesnt have unsigned types
09:18 AM rue_house: thats java and its not part of a number class?
09:18 AM rue_house: other than school junk, why would anyone use java?
09:18 AM Thrashbarg: <Emil> Java should burn in hell
09:19 AM * Thrashbarg raises his glass to Oracle
09:19 AM rue_house: well, java is ok, its just bloated, slow, leaks memory, and is unstable as all hell
09:20 AM Thrashbarg: it's like COBOL for the 21st century
09:21 AM Thrashbarg: here's a programming paradigm for you: everything is syntax sugar
09:29 AM polprog: i did java as my first language
09:29 AM polprog: it usable
09:30 AM polprog: and you can create GUIs fast and easy
09:31 AM psf: I'm in a fight with my college, they LOVE Java. Everything needs to be in fucking Java.
09:31 AM rue_house: I agree, but not that its usable
09:31 AM Thrashbarg: yuuuup
09:32 AM rue_house: too many memory leakage and stability problems
09:32 AM polprog: but honsetly it would be impossible for me to write java in anything but eclipse
09:32 AM rue_house: if you need a program that calculates one thing and quits, its fine
09:32 AM Thrashbarg: you can use BASIC for that, rue_house :P
09:32 AM polprog: which is opposite for C/C++. eclipse sucks in everything but java...
09:32 AM rue_house: if a program needs to stay running for more than 20 minutes, java is not the right thing to make it in
09:32 AM noHitW_work: no it deosnt
09:33 AM noHitW_work: CDT plugin
09:33 AM psf: I would rather prefer using Shell+Zenity than using Java lol
09:33 AM * psf https://www.youtube.com/watch?v=Aa55RKWZxxI
09:33 AM polprog: CDT plugin sucks ass. and AVR plugin is no better
09:34 AM polprog: compared to text editor+terminal combo
09:34 AM rue_house: how about object oriented assembler "Oops, you did it wrong"
09:34 AM noHitW_work: what are the benefits?
09:36 AM polprog: doesnt hog any memory
09:36 AM noHitW_work: well, i need to head home, cya ->
09:36 AM polprog: cya
09:36 AM rue_house: nonportable
09:37 AM polprog: huh, how would an OOP CPU look like :D
09:37 AM rue_house: well its larger.
09:39 AM polprog: from my experience java works for pure OOP, i tried to do some structural programming (finding primes), *that* was terrible
09:42 AM bss36504: rue_house: When was the last time you actually wrote some software with java? It's not unstable "past 20 minutes" and doesnt leak memory like you think it does. The new G1C garbage collector from java 7 onward is leaps and bounds better than the old GC
09:43 AM polprog: and people write server apps in that with tomcat
09:43 AM polprog: it's not THAT bad ;)
09:43 AM bss36504: Most memory leaks come from crappy code, not from a crappy runtime. I really don't understand the hate on Java. Yall are just upset that it's not running on bare metal and that there is a "Virtual Machine" layer in between
09:43 AM rue_house: I'v tried to use dozens of java programs for things that I needed and not once have they been able to do what they were supposed to without crashing
09:44 AM bss36504: AND, it's been proven that under certain circumstances, the performance of java is almost as good as C++ (note that I say almost, because I admit it is somewhat slower), BUT, the important feature of java is the cross platform nature without recompilation, which C++ is not capable of.
09:44 AM polprog: this so much
09:44 AM bss36504: rue_house: Maybe you just use shitty programs
09:44 AM bss36504: you can't overcome bad programming no matter how good or bad the language is
09:45 AM bss36504: I've never had any major problems with java stuff I've written, and my company deploys a java application that works great
09:45 AM bss36504: We use it because we don't know the target architecture, and the JVM just takes care of that for us.
09:45 AM polprog: i even wrote a game in java
09:45 AM polprog: once
09:46 AM bss36504: Minecraft is written in java
09:48 AM bss36504: Anyway, I never understand the hate for java. The loudest complainers are always C/C++/Embedded people, because they just keep parroting the same nonsense about how Java may have been not-so-great a decade ago. But it serves a purpose and does it well for the most part, and unless anyone has some concrete comparisons or examples the argument is jus
09:48 AM bss36504: t ridiculous.
09:52 AM Emil: bss36504: well
09:52 AM Emil: just because you can
09:52 AM Emil: doesn't mean it's not an antipattern )
09:52 AM Emil: ;)
09:53 AM polprog: java is just not for embedded in a same way you dont write web apps in assmebly
09:53 AM bss36504: What do you mean? If you use java as an OOP language, that's not an antipattern
09:53 AM bss36504: polprog: Yes, precisely.
09:53 AM polprog: :)
09:53 AM bss36504: ruling out a language just because it rubs you the wrong way is dumb.
09:53 AM bss36504: Now, if we want to hate on PHP, that's a different story ;)
09:54 AM polprog: PHP is just bad design, i'd only use it for filling website templates
09:55 AM polprog: as a kind of a server side frontend
11:50 AM Lambda_Aurigae: I write all my web stuff in C.
11:50 AM Lambda_Aurigae: it's just what I know.
11:50 AM Lambda_Aurigae: and it works.
12:03 PM psf: you should try asm, works like a charm
12:03 PM * psf finally, got the goodies from Ali (still has 2 orders for delivery).
12:17 PM Casper: still awaiting one package from ali, I guess I won't get that one...
12:18 PM psf: how long are you waiting?
12:29 PM Emil: Casper: just put in a dispute?
12:30 PM Casper: my account has been terminated due to some stupid support there... but who care, it's a 2$ package
12:30 PM Casper: hint: don't follow the support advice
12:30 PM Emil: lol
12:30 PM Casper: nobody seems to know what the actual 60 days delivery is, not even ali or the sellers...
12:31 PM Casper: it is NOT 60 days to the door... it's really 60 days to the country...
12:32 PM Casper: 55-70 days in, the support strongly suggested to open a dispute for all my orders, in fact, they almost forced me to...
12:33 PM Casper: nobody was bright enought (including me in a way) to explain the actual 60 days... which is 60 days + customs + 10 days unwritten
12:33 PM Casper: so really, there is no warranty
12:33 PM Casper: and instead of explaining it, they closed the account
12:33 PM psf: first time buying from Ali... so far so good. :) And the seller seems to be really good, bought around 30 USD, the custom doc was saying 8 USD :P
12:34 PM Casper: psf: yeah they often lie on the forms
12:34 PM psf: Took 47 days (35 work days) from Singapore to Rio, Brazil.
12:34 PM Casper: they will often write gift or commercial sample
12:34 PM Casper: both have no customs usually
12:34 PM psf: true...mine says Gift
12:35 PM psf: Brazil has a limit of 50 USD if it's a gift. If it's above 50 USD, even as a gift, you pay taxes (60% to 80% of the total cost [products + shipping]) iirc.
12:36 PM Casper: ... and rain again...
12:36 PM Casper: WOW
12:37 PM Casper: here it's over 20$CAD, you pay the custom fees (6-15$ or more on special stuff) + 15% tax
12:41 PM Emil: Customs is like 2%in Finland + 24% vat
12:42 PM Emil: Wtf is that 60-80% taxes?.:D
12:42 PM Emil: The European limit is like 22e for vat
12:42 PM Emil: and 150e for customs
12:43 PM psf: yeah, Brazil sucks
12:44 PM psf: Unfortunately, it's nice to see the sellers lie on the custom forms.
12:44 PM psf: I need it hehe
12:59 PM BongoShaftsbury: what should i do if i have more modules than i have ports
01:02 PM Lambda_Aurigae: "ports"?
01:02 PM Lambda_Aurigae: need more details here.
01:02 PM Lambda_Aurigae: what modules, what ports?
01:02 PM BongoShaftsbury: i have a board atxmega256a3bu
01:02 PM Lambda_Aurigae: that is a chip, not a board.
01:02 PM BongoShaftsbury: xplained
01:03 PM Lambda_Aurigae: well, at this point I would say buy another board.
01:03 PM BongoShaftsbury: if i'm not mistaken i can use 2x usart conncetions
01:03 PM BongoShaftsbury: i want to use 3
01:03 PM Lambda_Aurigae: because no way am I going to be able to explain to you how to interface those modules through i2c or spi expansion chips.
01:03 PM Lambda_Aurigae: how many usarts does that chip have?
01:03 PM BongoShaftsbury: 2
01:04 PM Lambda_Aurigae: you sure?
01:04 PM Lambda_Aurigae: because the datasheet I'm looking at says 6.
01:05 PM BongoShaftsbury: i think the other ones are being used for other stuff like LCD
01:05 PM Lambda_Aurigae: then I suggest finding out for certain.
01:05 PM Lambda_Aurigae: read the datasheet, study the board schematic.
01:06 PM Lambda_Aurigae: if you are out of hardware USARTs then you could always implement one or more software UARTs
01:06 PM xentrac: 47 days seems like a long time
01:07 PM BongoShaftsbury: i was thinking of making a bus and just alternating between the devices
01:08 PM xentrac: yeah, you can totally do that
01:08 PM xentrac: if you have a chip select line for each device, say
01:08 PM xentrac: that's the normal way people use SPI
01:09 PM xentrac: correct me if I'm wrong, Lambda_Aurigae
01:09 PM Vexer: A lot of SPI devices have CS lines for that reason.
01:10 PM xentrac: (and if they don't you can rig one up with an OR gate on the SCL line)
01:11 PM psf: xentrac: true, but I can't complain... I received two orders today, one of them took 35 days to get down here in Rio and the other 47 days. [if you are talking about what I wrote earlier hehe, if not my bad]
01:13 PM BongoShaftsbury: thanks Lambda & xentrac i will look into both
01:15 PM xentrac: I was!
01:20 PM psf: I wrote my first blinking led haha, nice.
01:24 PM BongoShaftsbury: congrats
01:26 PM Vexer: psf: which chip are you playing with?
01:26 PM psf: Thanks. :) it feels good dumping Arduino IDE
01:27 PM psf: Vexer: atmega328p for now.
01:27 PM Vexer: My old friend :)
01:27 PM psf: I believe this is the #1 chip when folk start right?
01:27 PM Vexer: Arduino kind of drives it in that direction.
01:27 PM psf: true
01:30 PM noHitW_work: i got a atmega328pb this week
01:31 PM noHitW_work: in this little dev board
01:31 PM noHitW_work: it was pretty cheap, under 10 euros
01:32 PM Vexer: Are you using the dual UART at all?
01:32 PM noHitW_work: but its sad that atmel(microchip) designs these board in a way that you cant use them as programmers for external chips
01:33 PM Vexer: I had to fight with a PicKit3 yesterday, and my microchip rage is at an all time high.
01:33 PM noHitW_work: then nobody would buy atmel-ice
01:33 PM Emil: psf: fortunately*
01:33 PM psf: Emil: not sure... it would be fortunately if they didn't have to lie heheh
01:33 PM bss36504: noHitW_work: Well Atmel ICE is just their EDBG ASIC in a pretty box
01:33 PM noHitW_work: st gives their programmers/debuggers basicly for free, i dont know what's wrong with atmel and their tools
01:34 PM BongoShaftsbury: st?
01:34 PM bss36504: ST Micro
01:34 PM Vexer: st micro.
01:35 PM Emil: psf: you said "unfortunately, they lie on the customs, which is nice"
01:35 PM psf: Emil: and hey, thanks for your tutorial... really good. Not sure why on objcopy you have ".text" and ".data". Where I can find more information about it?
01:35 PM Emil: psf: you can try the manual or documentation pages
01:35 PM Emil: but I'm glad you like it!
01:37 PM Emil: psf: so man "avr-objcopy"
01:38 PM psf: not sure but I tried... didn't find any good info I believe.
01:38 PM Emil: psf: basically only those two sections contain relevant data
01:38 PM psf: got caught up for some time reading avrdude man page and the -U option... hehe...
01:39 PM psf: oh man, I'm really in love with this thing.
01:39 PM Emil: well, I think you can also add an eeprom section
01:40 PM psf: I'm not on my desktop now but iirc I just wrote: avr-objcopy -O ihex <in> <out> and it worked good. But yeah, I need to read more about it to see what's going on under the hood.
01:44 PM noHitW_work: https://mcuoneclipse.com/2013/04/14/text-data-and-bss-code-and-data-size-explained/
01:44 PM noHitW_work: psf you might wanna check that out
01:46 PM psf: noHitW_work: thanks!
01:48 PM Emil: So as a summary
01:49 PM Emil: bss is fucking stupid (why not just use data)
01:49 PM Emil: but you need text and data for the program to work
01:49 PM Emil: you need bss if you assume things about uninitialised data
01:55 PM psf: hmm, gotcha.
01:56 PM psf: one more thing, not sure where I can find the right -b <baudrate> value... I couldn't upload any code without "-b 57600".
01:56 PM psf: Where can I find this value?
01:57 PM psf: The man page it's related to the programmer id correct? Or I read that wrong?
02:03 PM Emil: psf: baudrate depends entirely on what bootloader you have burned
02:03 PM Emil: the two most common are 57600 and 115200
02:04 PM psf: oh, thanks. I've burned the arduino bootloader
02:04 PM Vexer: I think the Arduino bootloader is 19200, but I may be mistaken.
02:05 PM Emil: Vexer: nope
02:05 PM Emil: perhaps it was like that in the very early days
02:05 PM psf: sorry for the dumb question, I hate make them but couldn't find it on the man page.
02:05 PM Emil: nowadays and with pretty much all the chink shit it's 115200
02:05 PM Emil: psf: that baudrate?
02:05 PM psf: yeah
02:05 PM Emil: or the option?
02:05 PM psf: baudrate
02:06 PM Emil: Because that -b option is specified just fine in man avrdude
02:06 PM julius: evening
02:06 PM psf: it is, the man page is excellent... i'm saying that I couldn't find any info pointing to where I could find the right baudrate.
02:06 PM Emil: https://emil.fi/jako/kuvat/2017-06-30_21-36-19_oJg5jnYh.png
02:07 PM Emil: Vexer: it seems that arduino.cc has old as fuck specs
02:07 PM psf: So I just opened the Arduino IDE, turned on the verbose mode and took a look at the avrdude command
02:08 PM psf: And saw it was using -b 57600
02:08 PM Emil: All current arduinos use optiboot
02:08 PM Emil: psf: you have to know the correct baudrate
02:08 PM Emil: Unless the bootloader can autobaud
02:11 PM Emil: Imho it's strange that no autobauding is not done
02:11 PM Emil: sure it adds a bit of space complexity
02:11 PM Emil: But not much
02:11 PM Emil: Hmm
02:11 PM Emil: I should write my own bootloader firmware
02:11 PM Emil: With bells and whistles
02:12 PM psf: so the "chip" would figure out the correct baudrate and you wouldn't have to specify it with the -b option, you mean?
02:12 PM Emil: Weeellll
02:13 PM Emil: it depends on how you look at it
02:13 PM Emil: there's always _some_ baudrate you are communicating at
02:13 PM Emil: autobauding means that the programmer can freely choose its favourite
02:14 PM psf: hmmm
02:14 PM Emil: and the chips adapts
02:14 PM Emil: Hmm
02:14 PM Emil: I should really spec this
02:15 PM Emil: design a block diagram with some flow graphs
02:15 PM Emil: NIH is a beautiul thing
02:15 PM psf: but I believe for "the first time" they should agree on a common baudrate, so they can understand each other correct? And them proceed if necessary to a higher or lower?
02:15 PM psf: or am I brain farting?
02:15 PM Emil: first time?
02:16 PM Emil: No, autobauding means that the device adapts its register settings to match the programmers
02:18 PM psf: and how the device will know the right baudrate to match?
02:19 PM Emil: ...
02:19 PM Emil: It autobauds
02:19 PM Emil: it adapts
02:30 PM Emil: psf: say you are scoping an unknown signal that looks like uart
02:30 PM Emil: how do you determine the baudrate?
02:30 PM Emil: A micrcontroller can do it the same way
02:31 PM psf: lol man, I wrote my blinking led program today.... "scoping", "uart": http://images.memes.com/meme/1106867
02:31 PM Emil: :D
02:32 PM psf: give a few months I'll know all the shits there is to be know.
02:33 PM Emil: https://www.kumari.net/index.php/random/37-determing-unknown-baud-rate
02:35 PM psf: wow cool.
02:37 PM BongoShaftsbury: any recommendations on an oscope for digital signal analysis & rf analysis
02:37 PM Emil: BongoShaftsbury: How many thousands of Euros do you have?
02:37 PM BongoShaftsbury: infinity
02:38 PM BongoShaftsbury: but i prefer the units of USD
02:38 PM Emil: Buy the latest 40GHz baseband scope from Agilent?
02:40 PM Emil: Or tektronix
02:41 PM julius: uint8_t draw_state = 0; switch(draw_state >> 3) .... wouldnt this right shift shift zeroes around? draw_state should be: 00000000 in the beginning
02:41 PM BongoShaftsbury: fastest i saw from tek was like 6.25gs/s @ 2ghz
02:41 PM Emil: Oh you have seen nothing :D
02:41 PM julius: BongoShaftsbury: do you also prefer to shorten pounds with lbs?
02:42 PM Emil: julius: shifts work by shifting shit around and if it comes from the sides it is 0
02:42 PM BongoShaftsbury: emil: oh? how insane does it get?
02:43 PM julius: Emil: if it comes from the sides?
02:43 PM Emil: http://www.tek.com/oscilloscope/dpo70000sx
02:43 PM Emil: julius: no 1s are ever introduced
02:43 PM julius: im not going to click that link ;) that will be way to expensive
02:43 PM Emil: julius: it doesn't mention the price ;)
02:43 PM Emil: It just says to contact them for it
02:43 PM Emil: :D
02:43 PM julius: hehe
02:44 PM julius: means fucking expensive
02:44 PM Emil: julius: 0b11111111>>3==0b00011111
02:44 PM julius: yeah thats what i thought
02:44 PM julius: still this code runs....let me check
02:44 PM Emil: 0>>3==0
02:44 PM Emil: If you want to rotate there's an assembly command for that
02:45 PM BongoShaftsbury: so 23ghz is the lowest bandwidth holy crap
02:46 PM BongoShaftsbury: disregard i read it wrong
02:46 PM julius: ah yes, draw_state gets a ++ in the loop
02:49 PM julius: 33 lines of (working) code: https://bpaste.net/show/fe8cfa471701 i wonder why they use >> 3 on line 5. since the draw_state is counted upwards in the loop
02:49 PM julius: the code gives some text and graphics to a i2c display, always the same order of pictures
02:50 PM Emil_: Hmm
02:50 PM Emil_: Experiencing some lag on my server
02:51 PM Emil_: It could be the update they warned me about
02:51 PM Emil_: julius: >for(;;)
02:51 PM Emil_: that's cancer
02:51 PM Emil_: user while(1)
02:52 PM Emil: Interesting
02:52 PM Emil: Experiencing quite the lag
02:54 PM Emil_: Fucking netsplits
02:55 PM julius: cant say if i got lag here
02:55 PM julius: dont know if irssi got a tell for that
02:56 PM julius: Emil_: yeah the for looks ugly
03:04 PM cehteh: mhm
03:04 PM cehteh: i wont care :D
03:05 PM cehteh: use goto :D
03:05 PM cehteh: #define ever ;; for(ever) ;)
03:30 PM julius: line 5 is far more interresting
03:31 PM cehteh: some hidden division
03:31 PM cehteh: draw_:state/8
03:32 PM cehteh: ah later &7
03:32 PM cehteh: so draw_state uses the higher bits as tag and the lower 3 bits as value
03:33 PM cehteh: but switch(draw_state & ~7) case 0; .. case 8; case 16: should be more efficient, unless the compiler optimizes that
03:34 PM cehteh: &7 is one cycle, >>3 takes 3 cycles
03:35 PM cehteh: while, thinking, maybe the first one can be easier optimized into a jump table
03:35 PM cehteh: just check the generated asm
03:36 PM Jartza_ is now known as Jartza
03:36 PM Jartza: evening
03:36 PM cehteh: o/
03:37 PM psf: evening
03:37 PM julius: cehteh: thanks...will look into that
03:38 PM julius: looks ultra complicated.....when the result is that it switched between some drawing animations in a specific order
03:38 PM julius: evening
03:38 PM cehteh: julius: otoh doesnt look like it needs to scrape every available cycle, just keep it as is
03:39 PM cehteh: looks ok to me
03:39 PM julius: ok than its my skill
03:39 PM cehteh: maybe i'd made the code rather data driven than hardcoded
03:39 PM cehteh: but still when it does what it should, its ok
03:39 PM julius: ok thanks
03:40 PM cehteh: its not pretty, the outer for(;;) could increment the draw_state as well
06:00 PM NoHitWonder^: bss36504: word
06:01 PM NoHitWonder^: (about java)
06:06 PM Lambda_Aurigae: which word?
06:13 PM JanC_ is now known as JanC
06:17 PM Emil: https://federalnewsradio.com/defense-news/2017/06/house-panel-votes-to-split-air-force-create-new-u-s-space-corps/
06:20 PM enhering: A major step in human understanding of our place in the universe
06:21 PM enhering: If true.
06:23 PM Emil: Fucking huge if it happens
06:23 PM Emil: I mean FUCKING MASSIVE
06:29 PM cehteh: wtf
06:30 PM Emil: Okay. Bringing low-level systems online. Cracking the case in thirty seconds.
06:31 PM cehteh: starship troopers ftw!!!
06:32 PM Emil: He's hot! Blowing the pins in five...
06:37 PM xentrac: so I spent the last several hours doing really basic DSP stuff
06:37 PM Emil: And?
06:37 PM xentrac: trying to reduce algorithms down to their minimal essence so I could understand them
06:38 PM xentrac: I think I need to understand the Z-transform more deeply though
06:38 PM xentrac: here's a sine wave synthesized with the Goertzel algorithm; you can pipe the output to aplay or pacat
06:39 PM xentrac: main(s,t,u){for(t=32;u=s,1+putchar(128+(s+=s-t-s/8));t=u);}
06:39 PM xentrac: here's Karplus-Strong string synthesis
06:39 PM xentrac: s[72]={512};main(i){for(;;i%=72)s[i]+=s[(i+1)%72],putchar(s[i++]/=2);}
06:40 PM xentrac: and here's a PLL that you can pipe arecord to in order to do frequency identification (which I wrote a couple of years ago)
06:40 PM * cehteh offers xentrac some space chars
06:40 PM xentrac: s[72]={512};main(i){for(;;i%=72)s[i]+=s[(i+1)%72],putchar(s[i++]/=2);}
06:40 PM cehteh: take em, use em
06:40 PM xentrac: oops
06:40 PM xentrac: main(a,b){for(;;)putchar(b+=16+(a+=(b&256?1:-1)*getchar()-a/512)/1024);}
06:40 PM xentrac: oh, you can pipe these to indent or whatever
06:40 PM cehteh: you know writing such tight code wont make the resulting binary smaller :D
06:40 PM xentrac: but that makes them a heck of a lot less convenient to paste into IRC
06:41 PM cehteh: lol
06:41 PM cehteh: i intentionally saied only 'space' not 'newline'
06:41 PM Tom_itx: after all, that's really what it's about anyway
06:41 PM Tom_itx: code formatted for irc
06:41 PM xentrac: do you have indent installed? on Debian you have to install the "indent" package
06:42 PM cehteh: yes .. still looks ugly, maybe i shall try astyle
06:43 PM enhering: You should take the offer, xentrac
06:43 PM xentrac: hmm, I haven't tried that one
06:44 PM cehteh: astyle is considerably better than indent, but not that widespread installed
06:45 PM xentrac: I haven't been able to get it to process main(a,b){for(;;)putchar(b+=16+(a+=(b&256?1:-1)*getchar()-a/512)/1024);}
06:45 PM xentrac: so far
06:46 PM xentrac: if I just run it it says, "Cannot process the input stream"
06:46 PM xentrac: "Artistic Style has terminated!"
06:46 PM cehteh: huh
06:46 PM xentrac: so I must be running it wrong
06:46 PM cehteh: works for me
06:47 PM cehteh: but missing some options to make it nice (spaces linebreaks etc)
06:47 PM xentrac: oh, it wants me to give it a filename that it can modify
06:47 PM cehteh: does only basic things by default
06:47 PM cehteh: i use it without
06:47 PM cehteh: $ astyles
06:47 PM cehteh: ..paste code.. press ctrl-D
06:48 PM cehteh: >prints indented code
06:49 PM cehteh: anyway DSP stuff esp when it comes to optimizing yields really strange results, somtimes a lot simple steps can be convoluted into a short but complicated expression
06:50 PM cehteh: and for your examples you should give the types of a and b
06:50 PM cehteh: b&256
06:50 PM cehteh: so 'int' or unsigned?
06:52 PM enhering: Off topic: Is it safer to send data via usart in ascii or binary?
06:53 PM Lambda_Aurigae: enhering, it's all ones and zeros...doesn't matter.
06:53 PM Lambda_Aurigae: ascii is just a representation of binary data.
06:53 PM cehteh: its more about receiving
06:53 PM Lambda_Aurigae: so, it's all binary.
06:53 PM cehteh: sending text means its bloated a bit, but you dont have endianess issues and you can debug it easier
06:54 PM cehteh: and you have to write a parser for it
06:54 PM Lambda_Aurigae: interpretation at the far end is where the troubles come in usually.
06:55 PM cehteh: so i'd recommend to make a text based protocoll but design it carefully to make it unambigous and safe
06:55 PM Lambda_Aurigae: so, safer, really has no meaning.
06:55 PM enhering: In the old times, you could select if transfering a file via FTP by binary or not. Any of the options was more prone to errors?
06:55 PM cehteh: from within that text protocol you can have a "switch to binary" command
06:55 PM cehteh: thats something different. part of why ftp sux
06:56 PM enhering: I have a text protocol now. Binary messages would be much smaller.
06:56 PM cehteh: use binary only when performance matters AND you have carefully tested and working everything else
06:56 PM cehteh: not that much
06:56 PM cehteh: for example you can shorten common commands
06:56 PM cehteh: s for set for example
06:57 PM enhering: four bytes for a float in binary, against many more in ascii
06:57 PM cehteh: and transfering 32 bit integers .. in binary you always need 4 bytes while in text a 0 needs only 1 byte :D
06:57 PM cehteh: depends
06:58 PM enhering: I'm trying to decide how to send telemetry
06:58 PM enhering: ascii telemetry needs big strings. Or more CPU time slicing them.
06:58 PM cehteh: i still recommend with a bullet proof text first
06:58 PM cehteh: and no floats :D
06:59 PM enhering: I cut off all the floats from the system. They weere very prone to errors
06:59 PM cehteh: later maybe switch to binary, but dont forget what i saied about endianees and platform specific bits
06:59 PM cehteh: alinment and such
06:59 PM enhering: thanks, cehteh
06:59 PM enhering: thanks, Lambda_Aurigae
06:59 PM cehteh: usually you have to serialize and parse binary as well
06:59 PM enhering: yep
07:00 PM cehteh: when the telemetry channel has some limited bandwidth then binary makes sense
07:00 PM enhering: Now the system answers to commands, but it is taking too much CPU from the main cycle
07:00 PM cehteh: optimize your code :D
07:00 PM enhering: I want to send info only in the end of the cycle
07:00 PM enhering: my code is constantly under optimization
07:01 PM enhering: you can check it
07:01 PM cehteh: dont want
07:01 PM enhering: nobody would
07:01 PM cehteh: yeah :D
07:02 PM * cehteh hacks on his documentaton system ..
07:02 PM enhering: I have a communications module that talks to outer world and handles inter modular communications
07:03 PM enhering: I'm currently deciding if this module will handle the vehicle state, of if it will forward the commands to the pilot module which wuold handle the vehicle state information.
07:04 PM enhering: The communication maodule must be a mirror of all the relevant system info, the one which will go to telemetry
07:04 PM enhering: This architecture is not simple, if I want to keep coherence
07:09 PM cehteh: i once thought too about programming my own flight controller software
07:09 PM cehteh: but never had enough motivation
07:40 PM cehteh: http://git.pipapo.org/?p=pipadoc;a=blob_plain;f=pipadoc.html;hb=refs/heads/devel .. so enouh for today
08:02 PM xentrac: ah, I see, cehteh  —  I was trying to run it as just astyle
08:02 PM xentrac: oh, but the "astyles" command doesn't exist?
08:02 PM cehteh: that was a typo
08:02 PM xentrac: 23:19 < cehteh> and for your examples you should give the types of a and b
08:02 PM cehteh: just 'astyle'
08:03 PM xentrac: in C things default to int if you don't say what type they are. that's terrible style of course, but it's well-defined in the language
08:04 PM Emil: -Wall -Werror disagree
08:04 PM xentrac: -Werror means "give me errors for things that are warnings"
08:05 PM cehteh: but main doesnt take 2 int arguments so i expected you gave only a sketch
08:05 PM Emil: My friends -Wall and -Werror disagree* ;)
08:05 PM xentrac: it will refuse to compile comliant code because it's terrible style in cases like this
08:05 PM Emil: xentrac: it means "tell me about shit that I shouldn't do"
08:05 PM xentrac: nope, cehteh, it's perfectly working code on every platform I've ever written C on :)
08:05 PM cehteh: iirc that defaults to int was dropped with some ansi c standard, only older ones do that
08:06 PM xentrac: I think it may technically be UB to declare argv as an int though
08:06 PM xentrac: oh? like which one?
08:06 PM cehteh: dunno i am not going to check that
08:06 PM cehteh: try gcc with different --std options
08:06 PM cehteh: or read the C standards
08:08 PM xentrac: gcc -ansi -pedantic -std=c11 is happy to compile it
08:09 PM xentrac: of course that doesn't imply that C11 actually permits implicit type declarations like that. but I'm pretty sure it does
08:09 PM cehteh: could be
08:11 PM Emil: The standard is pretty shit anyways
08:12 PM Emil: Compilers do a lot of useful things
08:12 PM Emil: That aren't in the standard
08:12 PM Emil: Also remove keb... I mean types like char, int, long and shit
08:12 PM Emil: and replace with s8, u8, and so on
08:12 PM Emil: uint8_t is just känser
08:14 PM Emil: Now
08:14 PM Emil: good night
08:14 PM ohsix: if anyone says something about c is well defined they're probably wrong
08:16 PM NoHitWonder^: what's wrong with uint8_t?
08:17 PM Lambda_Aurigae: so make some defines and name them whatever you want.
08:18 PM NoHitWonder^: we switched to "_t" suffix with custom types, its widely used coding style
08:23 PM Lambda_Aurigae: yeah..never understood the _t thing.
08:39 PM Thrashbarg_ is now known as Thrashbarg
09:44 PM Tachyon` is now known as Tachaway
09:54 PM evil_dan2wik is now known as dan2wik
10:08 PM Tachaway is now known as Tachaway`
10:28 PM enhering: back
10:44 PM theBear: front
10:45 PM enhering: taking sides, huh?
10:45 PM theBear: oooh ! i see what you did there <grin> well played sir !
10:46 PM Thrashbarg: hmm
10:46 PM enhering: crazy talk...
11:09 PM FrankD_ is now known as FrankD