#avr Logs

May 23 2017

#avr Calendar

12:19 AM day__ is now known as daey
03:48 AM Haohmaru: anyone know if the usb issue with avrdude+avrisp2clone on windows is fixed?
03:49 AM Haohmaru: i hope it works on linux at least
04:06 AM Haohmaru: which linux group do i need to be in to access avrisp2?
04:20 AM enhering is now known as Guest74035
04:39 AM Emil: Probably wheel
04:40 AM Emil: sorry
04:40 AM Emil: dialout
05:12 AM Haohmaru: seems it doesn't work on linux either :/
05:35 AM Hfuy: Hello.
05:35 AM Hfuy: I'm probably doing something really stupid, but, anyway. The question is here: https://pastebin.com/bEQ80dah
05:36 AM Hfuy: Why does spi_devices[dev][0] != NRF_PORT?
05:36 AM Hfuy: Oh. It should say spi_devices[dev][0] not [dev][1], but the question remains valid.
05:40 AM LeoNerd: Ohman what is this?
05:40 AM LeoNerd: Do you perhaps want to be using a struct insteade of a 2-element array?
05:40 AM LeoNerd: Yeah I'd definitely use a struct there
05:41 AM LeoNerd: struct spi_device { unsigned int pin : 3; unsigned int port : 5; unsigned int mode : 8 }; struct spi_device spi_devices[] = { { .pin = 3, .port = 5, .mode = 2 }, ... }; or whatever
05:42 AM LeoNerd: That way you don't need to remember which index [0]. [1] or [2] is whatever concept
05:42 AM LeoNerd: Plus theabove packs smaller into 2 bytes per element rather than 3, which makes a lot of RAM / flash / CPU difference on ATtiny chips which can't multiply by 3 and on which gcc is stupid
05:54 AM Hfuy: I did wonder about a struct, but it seemed a little heavyweight for such a simple operation.
05:59 AM Hfuy: Why am I making a struct of structs, rather than an array of structs?
06:00 AM Hfuy: Oh, I am making an array of structs.
06:00 AM Hfuy: Or am I.
06:04 AM Hfuy: I have to leave. I'll return later and follow this up. Thanks.
06:32 AM Emil: LeoNerd: wtf
06:32 AM Emil: LeoNerd: why would you use ints with bitfields :D
06:33 AM Emil: LeoNerd: you do know that bitfields dont work like that
06:35 AM Emil: LeoNerd: bitfields work by reserving ceil(required bits / base bits) base units
06:36 AM Emil: nowait I read your example wrong
06:36 AM Emil: nvm
06:36 AM Emil: caery on
06:36 AM * skz81 sadly drops the pop-corm he just grabbed
06:37 AM Emil: LeoNerd: but I do wonder how much cpu overhead that produces :D
06:39 AM Emil: LeoNerd: if gcc places the three bits into bits 7 6 5 then using them requires a lot of shifts
06:40 AM Emil: so while ram/pgmspace is saved you have cpu overhead
06:50 AM LeoNerd: Emil: Yah.. ultimately this port/pin SS idea is silly, I often feel
06:50 AM LeoNerd: My SPI wrapper code, for example, doesn't touch SS at all. It leaves that to the driver above it
06:51 AM LeoNerd: There's much nicer ways to do it that can compile down to a single instruction, in the way that any code using that memory structure above just wouldn't do
06:58 AM Emil: skz81: I had a brainfart and was thinking ints as 32 bit
06:58 AM Emil: insted of the 16 bit they are
07:00 AM skz81: Emil, ok. but doesn't matter AVR has 16bit int actually.
07:00 AM skz81: You just have the bitfield to be aligned with words. Here a word is byte since 8bit arch :p
07:01 AM skz81: the struct is two words wide and aligned, so no pb :)
07:15 AM Emil: skz81: gcc is "stupid"
07:16 AM Emil: if you declare 32 bit ints it will give you 32 bit ints
07:18 AM LeoNerd: On ATtiny, gcc is really stupid when it comes to non powers-of-2 multiplication. If you have a 2 or 4 byte element size in your array, fine. It'll shift the index. If you have 3 byte elements, it will generate a call to the generic 8bit multiply library function, having put the constant 3 into R17
07:18 AM LeoNerd: As opposed to, say, implementing that as (i*2) + i
07:19 AM skz81: <Emil> if you declare 32 bit ints it will give you 32 bit ints << on 32bits archs, int AND words are 32bits, I agree. But on AVR, the size is not the same
07:20 AM skz81: Still you align you bitfiled struct on words, not on ints
07:21 AM skz81: your bitfield struct*, sorry
07:33 AM twnqx: i actually align on bytes, by power of #pragma
07:45 AM enhering is now known as Guest91005
08:27 AM Emil: skz81: mate :D
08:27 AM Emil: context :D
08:27 AM Emil: 14:28:03
08:28 AM skz81: Emil, can you UTC pls ? :p
09:00 AM Emil: 2017-05-23 15:57:50 +0300 < Emil> 14:28:03
09:17 AM corecode: hi
09:18 AM corecode: i think i found a weird bug in avrdude 6.3 for windows
09:18 AM corecode: it doesn't seem to parse upper case options as upper case, so -P gets parsed as -p
09:28 AM Emil: really?
09:28 AM Emil: I doubt that
09:29 AM corecode: well, at least when invoked via cmd
09:32 AM CipherWizard is now known as CWiz
09:36 AM polprog: > ##ads ##nudism
09:36 AM polprog: why is there a channel for ads o_O
09:37 AM Casper: why wouln't it be one?
09:37 AM polprog: do they literally discuss ads there...?
09:37 AM polprog: wat
09:38 AM specing: Someone has to make ads
09:41 AM corecode: Emil: yea that was my reaction as well
09:41 AM corecode: Emil: but that's what's happening
09:43 AM Emil: polprog: what are those channels
09:44 AM polprog: looks like somebody parted
09:45 AM polprog: darsie [..~darsie@84-113-55-42.cable.dynamic.surfer.at] has left #avr [" ... ##ads ##sexology"]
09:50 AM Emil: lol
09:50 AM Emil: polprog: ah yeah you are doing sigint
09:50 AM Emil: nice
09:50 AM Emil: I do that too
09:50 AM polprog: sigint>
09:50 AM polprog: ?
09:51 AM Emil: you wii other people to see what channels they are on
09:51 AM Emil: also
09:51 AM Emil: 2017-05-23 17:18:14 +0300 < Elepaja> [Emil Fihlman] I have made a big mistake <photo> https://elepaja.fi/telegram/media/AgADBAAD26kxG388IVFfTPfwTwoNTJ3XvBkABA0AAYSlhfhYp95JAQABAg.jpg
09:51 AM Emil: 2017-05-23 17:18:37 +0300 < Elepaja> [Emil Fihlman] Eikä ees solder maskii oo ku kuulin vasta myohemmin et 2mil soldermask on mahdollinen
09:51 AM skz81: <corecode> well, at least when invoked via cmd >> MS-DOS being cas-insensitive, it may be "normal" (cmd would lower() any string you type for sake of simplicity)
09:52 AM Emil: dat 14-DFN was smaller than I expected :D
09:52 AM Chillum: very small
09:53 AM Chillum: like this http://www.proto-advantage.com/store/images/PRODUCTS/IPC0067_0.JPG ?
09:53 AM Chillum: but 2 more pins I assume
09:53 AM Chillum: 4 more I guess
09:53 AM Emil: it will take absolutely miniscule amount of solder paste
09:53 AM polprog: Emil: it's a case of not knowing the commands of your client :P
09:54 AM Emil: polprog: what is?
09:54 AM polprog: the part message
09:54 AM Emil: part?
09:54 AM polprog: darsie's client misinterpreted the cjannel list as the part message
09:55 AM Chillum: I would spread out the minuscule amount of solder over several pins
09:56 AM skz81: <polprog> darsie's client misinterpreted the cjannel list as the part message >> or he set it explicitely to this value, more likely
09:58 AM Emil: polprog: lol
09:58 AM Emil: Chillum: yeah
09:59 AM polprog: Emil: that dfn is terribly smal
10:00 AM polprog: is that 0806 next to it?
10:00 AM Emil: 0805 you mean? No, 0603 :D
10:00 AM polprog: :O
10:00 AM Emil: yeah :DD
10:00 AM polprog: oshpark i see
10:00 AM polprog: my mill has more colors to choose from
10:01 AM polprog: my next order will be either yellow or red
10:01 AM polprog: becuase i wanna test every color
10:01 AM polprog: probably next version of cthulhu will be red
10:01 AM Emil: OSHPark is superb :3
10:01 AM Emil: polprog: link a pic of that board
10:02 AM polprog: also, what do i need to use that esp? ive ordered two modules 6 months ago and havent got my hands on them
10:02 AM polprog: ill link it in a sec
10:02 AM polprog: which site do you prefer to post an album?
10:03 AM polprog: i only have archival photos since the only assembled one is in germany :P
10:04 AM polprog: actually wait
10:04 AM polprog: i have two PCBs in the drawer
10:05 AM polprog: https://puu.sh/vZ7W7/1fad65bb19.jpg
10:06 AM Emil: polprog: I prefer you host your own content ;)
10:07 AM Emil: polprog: what version of esp do you have?
10:07 AM Emil: nodemcu v1.0 are really nice imho
10:07 AM Emil: polprog:
10:07 AM Emil: that
10:07 AM Emil: https://emil.fi/jako/kuvat/2017-05-23_17-37-39_P3nXai63.png
10:08 AM polprog: https://puu.sh/vZ83D/3fbac0aedb.jpg
10:08 AM Emil: Also those trace widths
10:08 AM polprog: Emil: you picky bastard :v
10:08 AM Emil: not much current are you putting through them :D
10:08 AM polprog: i designed that board 4 months ago
10:09 AM polprog: not much becuase i oversetimated the optocouplers current capacity
10:09 AM polprog: turns out it can be 75 ma
10:09 AM Emil: lol
10:09 AM Emil: well you learned to look at the datashits ;)
10:09 AM polprog: the whole IO part is fail
10:09 AM Emil: what does that board do?
10:10 AM Emil: also I see you've learned the designer ways ;) https://emil.fi/jako/kuvat/2017-05-23_17-39-42_pQTEylq0.png
10:10 AM polprog: the one in germany... waits a specified amount of time, which you can set on the bodged-on pcb with 2 buttons and a 2x7 seg, then turns on a water pump for a moment
10:10 AM polprog: I see you quickly found the easter egg
10:10 AM polprog: i put those on most boards i design
10:10 AM polprog: :)
10:11 AM Emil: Nice
10:11 AM Emil: I'm quite bare with my design
10:11 AM Emil: only functionality, realy
10:12 AM polprog: have you seen the 2nd photo?
10:12 AM Emil: The one with the cthulhu text?
10:13 AM polprog: yes
10:13 AM polprog: fuck the laundry machine is leaking again
10:13 AM polprog: it's the 3rd time an i know the fix ;P
10:14 AM Tom_L: but you didn't fix it
10:15 AM polprog: actually it was a belt obstructing the big gasket this time
10:15 AM polprog: i thought it was the stupid valve
10:16 AM polprog: im taking the control pcb from that laundry machine when it fails totally
10:16 AM polprog: maybe i will be able to do something funny with it
10:19 AM Chillum: make a machine that dirties clothes
10:20 AM polprog: i was thinking snake
10:20 AM polprog: or tetris
10:24 AM Casper: that has been done
10:24 AM polprog: surely
10:24 AM Casper: there is a compagny somewhere in the usa that use washing machine that is filled with mud
10:24 AM Casper: and use them to mud-stain some cloth
10:24 AM polprog: ah i thought you meant tetris :P
10:25 AM Casper: but you do have some tweeting washers and dryers...
10:25 AM Casper: heck, there is even some tweeting toilet, that tell the time the user sat on it
10:37 AM polprog: Emil: i have one of the first esp versions i guess
10:37 AM polprog: let me check
10:38 AM polprog: Emil: ESP-12-E
10:41 AM polprog: on the super crude breakout board, https://puu.sh/vZ9II/e96fb65e34.jpg
10:51 AM Emil: polprog: yeah esp-12e is fine
10:51 AM Emil: dat board is not fine, though :D
10:52 AM Emil: you do realise that the antenna does not like the bounceback from that protoboard metal :D
10:52 AM Emil: cut the protoboard that obscures the antenna away
10:52 AM Emil: Anycase
10:53 AM Emil: https://emil.fi/jako/kuvat/2017-05-23_18-22-48_DXw1ndeM.png this should be enough to program it with a serial port that has dtr
10:54 AM polprog: Why DTR there?
10:54 AM polprog: xplain pls
10:54 AM Emil: you know how a serial bootloader works?
10:54 AM polprog: not really
10:55 AM Emil: okay so um
10:55 AM Emil: you know when bootloader is run, right?
10:55 AM polprog: nor do i have a decent rs232 converter
10:55 AM polprog: yeah, i know how does bootloader work
10:55 AM Emil: wat? use a usb to uart bridge
10:55 AM polprog: i inly have a buspirate
10:55 AM polprog: only*
10:55 AM Emil: umm
10:56 AM Emil: you don't have anything like this
10:56 AM Emil: http://www.ebay.com/itm/Replace-FT232-6Pin-USB-2-0-to-TTL-UART-Module-Serial-Converter-CP2102-STC-/321546809495?hash=item4addaef097:g:BhIAAOSwzLlXhzWQ
10:57 AM Emil: http://www.ebay.com/itm/Replace-Pl2303-CP2102-USB-To-RS232TTL-CH340G-Converter-Module-Adapter-STC-NEW-GM-/262136733346?hash=item3d08911ea2:g:s~0AAOSwQYZW1PaS
10:57 AM Emil: Well, you can use your arduino, too :D
10:57 AM polprog: i dont have an arduino either :P
10:57 AM Emil: any avr, really
10:57 AM Emil: anything that appears as a serial port
10:57 AM Emil: and can pass data through
10:58 AM polprog: serial capable stuff i have is the pirate, a couple raspis, and i will be getting an expresscard for the lappy
10:58 AM polprog: ok, suppose i can communicate serially
10:58 AM Emil: you can use a raspi directly
10:58 AM polprog: i think that chip can run as a slave deivce, amirite?
10:58 AM polprog: like, you control it via uart from whatever
10:58 AM Emil: http://www.esp8266.com/viewtopic.php?f=6&t=1816
10:58 AM Emil: polprog: you can program whatever you want into the esp
10:59 AM Emil: polprog: there might be the at firmware inside
10:59 AM Emil: but just overwrite it
10:59 AM Emil: It's cancer
11:00 AM polprog: can you program it in pure c under linux, no proprietiary ide stuff
11:00 AM polprog: like avrs?
11:00 AM Emil: yes
11:00 AM Emil: but I don't recommend that
11:00 AM polprog: sorry for those questions but i dont know much about it except it exists
11:01 AM Emil: This is the rare instance that I recommend using arduino :D
11:01 AM Emil: Because they have managed to package the esp8266 toolchain nicel
11:01 AM Emil: y
11:01 AM Emil: And the sdk is apparently känser
11:02 AM polprog: guess i will just use it as it is
11:02 AM Emil: why would you do that
11:02 AM Emil: just reprogram it with a program of your selection :D
11:02 AM polprog: because i dont have an arduino?
11:02 AM Emil: wat
11:02 AM polprog: oh
11:02 AM Emil: you don't need an arduino :D
11:03 AM Emil: Just install the arduino ide to get nice support for the esp
11:03 AM polprog: ah
11:03 AM polprog: ok
11:03 AM Emil: https://github.com/esp8266/Arduino
11:03 AM polprog: im ordering that cp converter, because i need that anyways
11:03 AM Emil: buy 3
11:03 AM Emil: or
11:03 AM Emil: 5
11:04 AM Emil: and make sure to get the cp2102 version
11:04 AM Emil: pl... and ch... are not so good
11:04 AM Emil: avoid pl... like the plague
11:04 AM Emil: ch340g is fine
11:04 AM Emil: but the cp2102 is best imho
11:04 AM polprog: wait no
11:04 AM polprog: i have a ch340 dongle
11:05 AM polprog: its just it was advertised as rs485 dongle
11:05 AM polprog: ill see if it has the rx pin on the pcb, apparently it has tx and gnd broken out
11:05 AM polprog: no
11:05 AM polprog: that doesnt make sense
11:06 AM Emil: you don't need the dtr either if you just use a button
11:06 AM Emil: or something
12:48 PM polprog: hmm
12:49 PM polprog: i lost that dongle
12:55 PM Tom_L: can't find my xilinx jtag dongle either
12:57 PM Casper: Tom_L: time to do a spring cleanup?
12:57 PM Tom_L: naw, no tellin what else may get uncovered
12:58 PM evil_dan2wik is now known as dan2wik
01:09 PM Casper: spiders, ant, snakes, rats... and more spiders?
01:47 PM day__ is now known as daey
02:06 PM Emil: wtf
02:06 PM Emil: is my logging off again
02:15 PM polprog: well
02:15 PM polprog: i just checked my log,
02:16 PM Emil: and?
02:18 PM polprog: and give me a moment
02:18 PM polprog: making grep work with regex
02:21 PM polprog: and you ve got 3 quits logged since i lo
02:21 PM polprog: log*
02:21 PM polprog: wow
02:22 PM polprog: stable session, gc
02:22 PM polprog: ;)
02:23 PM Emil: me?
02:23 PM Emil: lol 3 quits is shit
02:24 PM Emil: one of them is when I closed my shit to start fresh
02:24 PM Emil: and the other two should be when DO decided to do disruptive maintenance
02:27 PM polprog: since 26 march
02:27 PM polprog: that's a whole month
02:27 PM polprog: i should check how many i have
02:27 PM polprog: nine
02:28 PM polprog: hmm
04:20 PM Jan-: is there some way to declare an array of structs in place, like you would in javascript foo = [x,y]
04:21 PM Jan-: I guess that's a C question as much as an AVR question
04:22 PM Emil: Jan-: whatcha mean?
04:22 PM Emil: like you want a number of structs with certain values?
04:22 PM Jan-: yes.
04:22 PM Emil: Sure, of course it is possible
04:23 PM Jan-: Instead of having to create the structs
04:23 PM Jan-: then assign them to the array
04:24 PM Emil: you still need to define the struct but that's only the definition for the compiler. After that you can do (struct asdf){.member1=x, .member2=y, ...}
04:24 PM Emil: but they are static
04:24 PM Emil: if you want mutable then declare an array
04:24 PM Jan-: that's one struct
04:24 PM Jan-: what if i want an array of structs
04:24 PM Emil: you should be able to continue from that
04:25 PM Jan-: huh?
04:25 PM Emil: (struct *asdf){{1,2}, {3,4}, ...}
04:25 PM Jan-: see I tried that
04:25 PM Jan-: I get "expected primary expression before . token"
04:25 PM Jan-: on .pin = NRF_CSN_PIN,
04:25 PM Emil: (struct *asdf){{1,2}, {3,4}, ...}[i]
04:26 PM Jan-: wha?
04:26 PM Emil: you need to index it
04:26 PM Emil: if you want to access the members
04:26 PM Emil: or your syntax is wrong
04:26 PM Jan-: I don't really get what you mean
04:27 PM Emil: have you defined your struct?
04:27 PM Emil: before
04:27 PM Jan-: yes.
04:27 PM Emil: wellthen share the code
04:28 PM Emil: or ask in ##c
04:28 PM Jan-: https://pastebin.com/7AF9XCNa
04:28 PM Emil: The point is, yes you can have compound literals
04:38 PM Emil: Jan-: sorry
04:38 PM Emil: struct asdf[]
04:39 PM Jan-: huh?
04:39 PM Emil: not struct *asdf
04:40 PM Emil: https://emil.fi/jako/kuvat/2017-05-24_00-10-18_LebeXbmM.png
04:41 PM Emil: But really
04:41 PM Emil: you should use progmem instead of compound literals like this
04:41 PM Jan-: sorry I can't see the picture
04:41 PM Emil: Eh?
04:41 PM Jan-: I'm using a screenreader
04:42 PM Emil: ah
04:42 PM Emil: sorry
04:42 PM Emil: a second
04:44 PM Emil: #include<stdio.h>structa{charb;};intmain(void){inti;for(i=0;i<3;i++){printf("%d\n",(structa[]){{.b=1},{.b=2},{.b=3}}[i].b);}return(0);}
04:46 PM Emil: #include <stdio.h> struct a{char b;}; int main(void){int i; for(i=0; i<3; i++){printf("%d\n", (struct a[]){{.b=1}, {.b=2}, {.b=3}}[i].b);} return(0);}
04:47 PM Emil: Jan-: that one okay?
04:47 PM Jan-: sorry, no idea
04:47 PM Emil: whatcha mean?
05:08 PM Jan-: apparently this is something to do with not using C99 and not being able to use that style of initialisation
05:44 PM Emil: nope
05:45 PM Emil: c99 is not required
05:45 PM Emil: you can have literals just fine
05:45 PM Emil: c99 is more about declaring a variable where-ever you want in this regard
05:47 PM BongoShaftsbury: anybody have any recommendations for a decent assembly avr book?
06:05 PM Lambda_Aurigae: BongoShaftsbury, not a book but a website.
06:05 PM Lambda_Aurigae: http://www.avr-asm-tutorial.net/avr_en/
06:06 PM Lambda_Aurigae: it's what I learned AVR assembly from back when I started with AVR in 2002-ish.
06:52 PM Jan-: is it likely to be that hard to port some code from the atmega328 to the atmega2560?
06:52 PM Jan-: (I'm running out of RAM)
06:53 PM day__ is now known as daey
07:31 PM Mr_Sheesh: Jan- shouldn't be, usually my problem's been "oops the evil client now wants 27 more pins for added devices" :p
07:32 PM Jan-: well that too.
07:32 PM Jan-: RAM is my issue. I have a menu system with a lot of strings.
07:33 PM Jan-: it's shockingly easy to eat through a bunch of memory, even if you PROGMEM all the things.
07:33 PM specing: om nom nom
07:33 PM specing: sounds like you want an stm32
07:37 PM Jan-: people say that :)
07:38 PM Emil: Jan-: what kind of data structures are you doing that you are running out of ram?
07:38 PM Emil: Jan-: pls
07:38 PM Emil: Jan-: plase the strings in progmem
07:39 PM Emil: don't store them in ram
07:39 PM Emil: Also m328!=m328p
07:39 PM Emil: Keep that in mind when referencing chips
07:39 PM specing: if only Jan- could see that see wants the stm32
07:40 PM Jan-: the chip says "ATMEL MEGA 328P AU 1431"
07:41 PM Emil: which isn't m328
07:41 PM Emil: though the difference is not great
07:41 PM * Jan- has no idea
07:43 PM Emil: Point is
07:43 PM Emil: when you reference chips
07:43 PM Emil: do be specific
07:46 PM Jan-: didn't I?
07:47 PM Emil: 2017-05-24 02:22:06 +0300 < Jan-> is it likely to be that hard to port some code from the atmega328 to the atmega2560?
07:47 PM Jan-: I retract the question.
07:49 PM kre10s: hello. How many bytes of stack does it take to make a function call with two uint32_t args?
07:49 PM Emil: kre10s: depends if you have to push registers first
07:50 PM kre10s: true... assuming you dont have to?
07:50 PM Emil: well if you don't care about the situation now and want to call a function you usually place the arguments into registers and then push the return address
07:50 PM Emil: which you pop and reti at the end of your function
07:51 PM Emil: so that means 2 bytes of stack
07:51 PM Emil: but if you need to place the arguments into stack first then it is prolly 4*2+2
07:51 PM Emil: or something
07:53 PM Emil: I'm just doing an educated guess
07:53 PM Emil: I don't actually know if you have to do more or if that's all you need to do
07:54 PM Emil: if your compiler is smart enough and your function is simple enough you might not need to touch stack at all
07:59 PM kre10s: Basically I need to do this https://paste.ofcode.org/re7QVEKAt6ubkgUcfb563y and wanted to know about how much mem I need to be able do it.
08:00 PM Emil: kre10s: nonononoon
08:00 PM Emil: do
08:00 PM Emil: o
08:00 PM Emil: no
08:00 PM Emil: fucking
08:00 PM Emil: do
08:00 PM Emil: recursion
08:00 PM Emil: it kills ALL THE PERF
08:00 PM Emil: this kills the perf
08:01 PM kre10s: what is the perf?
08:01 PM Emil: also what the heck are you using uint32_ts? :D
08:01 PM Emil: also can you guarantee that b is always greater than a?
08:02 PM kre10s: The domain I need to scan is exactly (0;2^32) ... so a uin32_t is perfect; and yes a is always<=b
08:02 PM Emil: kre10s: what are you trying to do?
08:02 PM Emil: kre10s: your avrs don't have that much memory
08:04 PM kre10s: 2^32 would require 32 recursions to scan in this binary search way. assume 20 bytes per call. 32*20 is only 640 bytes. there are AVRs that can do that.
08:07 PM kre10s: I need to find all the devices connected to a canopen network. Each device has a 32bit universaly unique Id. I can address a node directly, or ask if a node exists between (a,b). since querying the network takes time; it's better to use a search.
08:08 PM Emil: ah
08:09 PM Emil: wellthen
08:11 PM Emil: recursion here is not actually too bad conceptually
08:13 PM Emil: but personally I would opt for a different style scan
08:13 PM Emil: than does not require recursion
08:13 PM Emil: it should be as performant also
08:15 PM Emil: Basically you have start s and end e points
08:15 PM Emil: and you query between them, right
08:16 PM Emil: what you want to do is fix s and move e in a binary division faction until you no longer get a response or you can't divide further
08:17 PM Emil: then you advance s to where you found the sample or to e
08:17 PM Emil: It finds everything, is as performan and most importantly is iterative
08:20 PM kre10s: got some pseudo code?
08:20 PM kre10s: Binary search requires the least amount of queries for a given number of nodes to find.
08:21 PM kre10s: that's why i chose it.
08:23 PM Emil: kre10s: you did read that through, right?
08:23 PM Emil: because it IS binary tree search
08:23 PM Emil: only that the sequency it searches at is modified
08:25 PM kre10s: Oh. I see it now.
08:25 PM Emil: sequence*
08:29 PM Tachaway is now known as Tachgrr
08:30 PM Tachgrr is now known as Tachgr
08:39 PM kre10s: But wont that aproach will waste queries...
08:40 PM Emil: no
08:40 PM Emil: since you move s when you no longer find a node or can't divide further
08:51 PM Emil: Holy shit the people in ##electronics are retarded
08:51 PM Emil: not only is Jan- spreading his stupidity everwhere
08:54 PM Emil: But there are also retards who argue only for arguing and spread idiocy everywhere
08:56 PM kre10s: But since you don't use a stack to keep track of previouse positions of e you end up scanning things multiple times.
08:58 PM Emil: nope
08:58 PM Emil: You have two variables that hold s and e
08:58 PM Emil: and one variable that holds the division section
08:58 PM Emil: If you need
08:58 PM Emil: but you realy don't
08:59 PM Emil: kre10s: since you need to scan for ALL nodes, right?
08:59 PM Emil: you cannot assume how many nodes there are and how they are distributed
08:59 PM kre10s: no i can not.
08:59 PM Emil: yeah
09:00 PM Emil: so even if you find one node withn your range you still need to binary tree search the remaining of that section
09:01 PM kre10s: right.
09:02 PM Emil: kre10s: so you fix s until you no longer find anything interesting and then skip s forward
09:03 PM Emil: it is exactly a binary tree search but s is fixed and only e moves
09:03 PM Emil: instead of both s and e moving
09:03 PM Emil: like in a traditional binary tree search
09:03 PM Emil: s moves when you have exhausted the tree for that section
09:05 PM kre10s: :/ my iterative implementation requires 4x more tests.
09:08 PM Emil: I can try to whip up some code soon
09:13 PM kre10s: minimal compilable example: https://paste.ofcode.org/grknNBu5u3HR68WeHwWZY
10:14 PM kre10s: How can I force avr-gcc to produce a call to a function instead of inlining it?
10:15 PM Emil: kre10s: if you really really really want to fuck up your code then do -O0
10:15 PM Emil: if you want to force a function call then make a function pointer that you call
10:20 PM timemage: kre10s, https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gcc/Function-Attributes.html you could use noinline attribute. if you're specifically trying to prevent it from inlining at a particular site you might be able to do something like store it in a pointer and then use the pointer, perhaps volatile qualifying the pointer.
10:21 PM timemage: kre10s, https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/Function-Specific-Option-Pragmas.html you can also probably GCC push_options, then GCC optimize "-Owhatever" prior to the function that makes the call, and then pop_options after it.
11:07 PM Tachgr is now known as Tachyon`
11:39 PM kre10s: awesome. Emil. The iterative aproach is strangely enough more efficient than a recursive one and requires roughly half the number of tests.
11:41 PM day__ is now known as daey
11:50 PM Emil: kre10s: np
11:54 PM Emil: kre10s: share the code