 Hello everyone and happy Friday. How's it going Isaac Ben and see Grover over on Discord and let's see Halati over on YouTube. Thanks for tuning in folks. Let me shuffle a couple of things around. It looks like I have sound at least into OBS so I think we're good. Let's see. How's it going Beata? Happy Friday. So let me turn off a couple of these previews and shuffle these windows around so I can see the chat. Take a drink of water. Alright and now we can get going. So hello everyone. My name is Tim and I go by FOMIGuy on GitHub and Discord. This is the CirclePython deep dive program. This program occurs every Friday at 2 p.m. Pacific or 4 p.m. Central Time which is the time zone that I'm in or 5 p.m. Eastern Time or you can find out whatever time zone it is for you by converting one of those times. In this program we are taking a deep dive into CirclePython. We are either usually looking at CirclePython libraries or coding projects or perhaps sometimes the core of CirclePython itself written in C code. So we are really getting into the kind of deep nitty gritty details of CirclePython on this program. This was a stream that was originally started up by Scott Shawcroft, the lead developer of CirclePython. He is away right now on paternity leave so I've been taking over and doing this stream for a little while and so that's what the stream is. If you are brand new to all of this though and you don't know what I'm going on about, let me take just a moment to introduce it for folks that might be new. CirclePython, this is basically an implementation of Python that runs on these tiny computers called micro controllers. This is the main website, CirclePython.org. You can go here to learn more if you're interested. We basically have a version of Python that runs on all of these tiny little computers. They come in all different shapes and sizes. They have all different kinds of things you can hook up to them, to do with them like sensors and buttons and beepers and lights and there's Cherry MX keys as well as RGB lights, knobs, screens. We do a lot with screens on my streams typically. You can save Python code to these devices and it will run for you. These just show up like a thumb drive essentially when you plug it into your computer. There's a Python code file on there. Open up that code file, edit your Python code and save it and it will automatically run on the device. That's kind of like high level what the project is about. It's an open source project. Anybody is allowed to help contribute. If you'd like to join the community, definitely head over and join us on Discord. That's a good place to go to get started. If you want to help with development, it all occurs out in the open, out on GitHub. You can join us over there. You can coordinate with us, chat in Discord. There's weekly meetings that occur every Monday inside the Discord channel. Those are a couple of different ways you can get involved. Like I did say though, it's an open source project. It's free to use. Everybody is allowed to contribute. Everybody is allowed to use CircuitPython on their devices. If you're a third party hardware manufacturer, you're allowed to port CircuitPython to make it run on your device for free. You don't have to pay anything in order to do that. CircuitPython as a project, though, is supported by this company Adafruit. They're a hardware and software company based out of New York. They're the company that is paying the team who works on CircuitPython. Some folks like Scott, Catney and Dan and Jeff are paid full time to work on the CircuitPython project and surrounding community and related things. Some other folks like me and a couple others are paid to work on the project part time. So thank you, of course, Adafruit for paying all of us to work on the project. And thank you to anyone watching if you want to help support the project by purchasing hardware from Adafruit. You can do that over at Adafruit.com. They sell all sorts of hardware, the microcontrollers themselves, all of the different kinds of sensors and doodads and add-ons and all those things that you can plug into your microcontroller to build interesting projects with. So thank you to them and thank you to anybody who does purchase hardware from them. Jumping into today's program, though, sounds great on YouTube. Thank you. I got here on time almost. Nice. Yeah, you're pretty much on time, I'd say. Thanks for tuning in, Harold. Let me catch up on a couple of the other chats here. Nas recently went end of life. Uh oh, thankfully, it was a long and productive life. Nice. Let's get at least eight years on a spinning disk. Happy, let's see, good midnight. How's it going, Axl Magnus? Thanks for tuning in, everybody. Uh oh, ruined both pies. That's not what we want. Nobody likes a ruined pie. This is a little fuzzy, isn't it? Let's see if we can sharpen that up just a tad. Jumping into today's program, though. What I'm going to work on is we're going to take a look at a that's a lot better there. We're going to take a look first at a utility made by community member C Grover, C de Grove Studios. So thank you to C Grover for making this and sharing it. This is a circuit Python palette filter and what this does for folks that were watching last week. I don't remember if it was on Friday or Saturday last week, it was one of my streams. For folks that were watching last week, though, this this idea spawned out of something that came up in one of last week's streams. We were talking about the idea of being able to sort of filter a palette by colors that are similar to the transparent color. So if you imagine, you know, a common scenario in circuit Python is you have some bitmap image, you want to make some portion of that image be transparent. In circuit Python, the way that you would do that is part of your image will be a certain transparency color such as I like to use green because it makes me think of a green screen, you can actually use whatever color you want. I'll show you an example of this if we can find one of these. Do we have two things where is? Right, these ones are the papyrus ones. That's right. So in this example, I have a bitmap image where I have green, the green becomes my transparency color. So on the display I O palette object, there's a function called make transparent, I think it is. And you can pass it the index of the color that you want to represent transparency. And then to let display I O will essentially, you know, neglect to draw any pixels that are that color, it will just skip them. So whatever was drawn beneath there will show through it will be as if it was transparent like in a PNG. So this is a common thing we want to do with display I O is use this idea of the transparency color, where the hang up comes in, though, or what this discussion was spawned from was when you have a transparency color, but because of some of the manipulations of your bitmap, the edges get a little fuzzy sort of the edges get anti aliased, or is it aliased, I don't actually know the correct term, the edges get kind of fuzzy, and it makes it so there are multiple shades of your color. To show you this, I'll open this file in here inside of GIMP papyrus. It is the font the font on this one is, well, it's technically it's called parchment, but I believe it's supposed to be very close to papyrus. This was one that I found that seemed to have a permissive license. And as far as I can tell, it is a copy of papyrus. But I don't know for certain. I don't actually recognize it. And I can't say as though I actually did look at papyrus specifically as well. My PC doesn't have papyrus. I think it comes preloaded like in Windows and maybe Mac. I'm not sure. Mine didn't have it. So I got to try to find a download of it that I can take a look at to compare. Excuse me. Okay, so when we have an image like this, we're going to have a palette. The palette is all the colors that are utilized within the image. And what you see here is we have like several different shades of green because of the manipulations that occurred on this bitmap. If I zoom into these edges here, then you can kind of see where these are coming from, right? We have like all the way green out here. And then we have a little bit different green, a little bit different, darker, darker. You know, each of these are like kind of close to green, but not quite green. So this is a utility that's going to try to find all of these, you know, similar colors to your transparent colors so that you can hopefully set them all to be transparent without necessarily having to like alter your palette. Because like here, you know, you can see what I've done is I've scooted all the greens to the beginning of the palette. So basically the first, you know, 12ish, maybe 11 colors are different shades of green. So then in my circuit python code, I've gone and said, you know, four loops, zero to 11, set, you know, make transparent that index, you know, zero, then one, two, three, four, all the way up, right? So, you know, that's not bad, but it's some manual work to come in here and go to your palette and, you know, drag these things around to get them all at the beginning or at the end or however you want to do it. Wouldn't it be nice if we had some kind of utility to help us do that and Cedar Grove has stepped up and said, yes, it would be nice and here it is. So that is what I'm going to play with first. Let me take a quick look at this. Okay. And of course I intend to use this most immediately on this flip clock, which I've got running on the device there that you saw. But obviously this is like, you know, a much more dynamically useful thing, right? Like this, there's lots of different uses for this thing within display IO. You could use it for lots of different reasons and it makes this idea of kind of like cutting out these colors much easier to do. So I'll clone it to start with, here's the link. I'll drop it in the chat if anybody is interested. I mean, you can obviously see the URL there as well, but if anyone else is interested in taking a look at the library that I will be tinkering with here and I'll close this thing. It takes up so much space here. Let's, there we go. I'll just clone it and then we'll start, take a look at the examples that are in there and just start tinkering away. And eventually we could try to work this into the flip clock. I don't know exactly if I'll do all of that at once. I do also want to try to work on the MPY file size thing, but I want to take a look at this first and foremost and then we'll see kind of where we go from there. Let's see, this is actually something different. Sorry about that. Let's go close that. How's it going to Shippu? Thanks for tuning in on this. I'll open it up in here. Let me open up one of the other ones first. Let's see if it's C for circuit Python I think. No pilot filter rather. This is always wanting to like change environments now. How's it going DJ Devon? So I will copy this over to my device as well and take a look at the code. Oh nice. There's a box PDF in here. Replacing color index values, target color along with the tolerance parameter. So you give it the color you want to target. You know in my case that would be the green which is like solid green. 255 green, 00 for red and blue. And then you give it a tolerance and it will kind of find all the things that are close to that tolerance. Well to that color and then you know far away enough based on your tolerance. Creates a new palette. Nice. Nice and I will say this bit's most likely over my head. The actual algorithms involved here. I'll pull this up though because I'm always interested in taking a peek at the kind of essence underneath a functionality. Color distance. Okay color difference. So this does this idea Euclidean distance. Sequels. Like we've had a bunch of different versions of this throughout the years. Got better and better probably and also has like different screens and different printing capabilities and all that stuff came along. I'm sure we can like more reliably represent more colors so it would make sense we got to get better and better being able to tell them apart. Let's see. Start with the examples that are in it and then we'll play with it some separately as well. This one is going to make a source. Colors does it. It looks like okay this one okay so simple test this one will just have the palette and then change it. There's no actual bitmap in this. Let's go to code. Let me do code as let's go papyrus flip clock. It's really flip digit I guess it's only one digit. I have flip digits with crossbars now too. I was working on that last night. I didn't stream it but I was working on that but I have not tested them out on the device yet. I haven't taken a look at them. Just generated the spreadsheets and worked on the generator script. Maybe we'll do that later on as well. Although I am like I said earlier I'm also interested in getting into the MPY file size thing I worked on a couple weeks back. We got some new new feedback to work on for that. I'm definitely interested in getting that project moving forward. So code pie here we can we already copy pasted something else so we'll go back and grab this. Oops oops oops. Authors. There we go. I had put something else in there. Did I change the font? I did yeah well it's called parchment technically but I think it's a copy of papyrus. I need to look a little bit further into it to make sure that's the case. That's what I that's my understanding so far. I did change it to that parchment which and the reason I chose parchment is because I found a copy of it with a license so if we want to put it in the repo then we need to have the license to it. Although it occurred to me after the fact that images I don't think we would need the font license for. So maybe I just won't maybe I will use pyrus but then just not put the the font itself in the repo because I think it's not I don't know that it's like open source or whatever. I mean it's easy to find but I don't. It's licensed for doesn't seem to be licensed for open source. So this one's mostly just gonna print and we'll need to be connected to the serial console in order to see it so it's it's one let's just take a step through the code here it's going to set up this palette the target color is 080808 which is must be some sort of grayish right I guess so this one's here and then okay these are all like one two three four five six seven eight nine okay and then they're all the same pattern. Okay so they're basically shades of gray and then it's got target color is eight fill color is none tolerance is set to four create a palette from the source colors so this is a list we make a palette we loop over the source colors we add them to the palette this is basically just making the palette wouldn't it be cool maybe this would be something we should do one day is a constructor for palette that takes a list then you could not need all this code at the application layer it could just be display a palette and then source colors you pass it in and it just creates it for you that'd be pretty sweet that would be a I think a change in the core but it would be easy enough I think it wouldn't be too bad probably I don't know I don't know that I if I worked with lists inside the core I think so maybe as tuples I don't remember for sure set the source set the source palette to make transparent and then it's in this case it's going make transparent three zero one two so that's this one you can see at the palette filter so you go source palette target color fill color tolerance it has print target color source color well source palette header row loop print these things index color and then is it transparent or not is transparent is this on palette I didn't know there wasn't is transparent it's pretty useful is that one palette must be right let's get my signature I also use papyrus uh for my name on the back of a pcb nice we'll have to see uh one yeah one list constructor make palette or or yeah it could be make palette I guess to instead of the uh if there's some reason it shouldn't be a constructor I've seen somewhere there's like functions that are like make thing or whatever inheritable oh inheritable so you could extend it how's it going arjun over on youtube thanks for tuning in it's not enough so there we go color converter well color converter is similar the palette should be a class also right it's going to be down lower it's transparent yeah I didn't know that had that interesting nice it's a good one to file away uh and then new palette so it's going to create the new palette for you uh we'll make it accessible on here yeah okay so palette filter palette and then it will print so it'll show us which ones are transparent in the after essentially so let's let it run and so this one was transparent initially and then here we end up uh true true true and it's the last three but that is because source I'm fine have a great day thanks yeah I appreciate it um so target here is targeting which one to make transparent in the output of this and then tolerance would affect the number so if we go I don't know if it goes up or down probably I guess if we make the tolerance bigger then that means more things could be made transparent so if we got a bigger a bigger tolerance we could eventually probably get it to do this one transparent also let's make sure to actually understand that though so if we tried six I don't see what the scale needs to be like oh yeah there we go nice okay okay sweet yeah that's pretty straightforward you just give it your target color it figures it out for you let's try this one graphics test zero for single color oh okay nice so you can you could still target it down to a single okay zero and then oh you know what let me switch back to this real fast I want to try a few more things if this is out of order does it uh so like if this was here okay nice so this basically this makes it so that you don't have to rearrange your palette which is awesome this means your palette can be all scrambled as long as you know your one target color so I guess I'll say your target your your palette can be scrambled if it were me I'd still probably move my green my one base green I probably move it to zero index zero but the rest of the palette can be scrambled you can tell it that green index and then it will find all the ones you know similar enough close enough based on your tolerance graphics test was designed for pi portal we can tweak it around if we need to yeah I can if I need different graphics or anything uh we can get it tweaked I think and I I have a pi portal here as well actually so if we need to switch over we can ultimately do it like uh flying lars let's copy that is it super big let's see oops is uh 320 by 201 let's see we could scale it down some or we could just try it 320 I don't remember what the size is let's see what it does this is like 240 by something let's take a look through this one it's gonna this one has got the image file uh couple of display parameters brightness for the display rotation background color none scale one okay image file target color as green fill color none tolerance invert what does fill color do we'll have to try that a little bit invert false tolerance one instantiate the display built-in display set the brightness at the rotation create a group for primary layer show it on the display create a rectangle that vector IO or shapes let's see shapes okay create a rectangle with shapes x y width height fill background color that's going to be fill none I guess on that one background color put that behind everything put the palette while image load bitmap source palette from this image file here I'll grid for it add it to the group that's showing create a label next text has target anchor point anchor position this one may end up off the screen for us we can tweak it to move it somewhere else or I'll probably just grab the pipe or actually it's right here as well target block smaller rectangle 30 by 30 fill it with the target color add that to the group add the label to the group fill label position fill color is none okay just set this transparent label if if fill color is none another 30 by 30 tolerance level label so we can print the tolerance this one has the word tolerance this one it looks like we'll get the value invert false add them all to the group there's our palette filter source palette target color fill color tolerance invert and then uh 765 frames count by twos so half that so then just change the tolerance each time so as the tolerance changes we get to see uh you know each time how close it is right we get to get a sense for like how close are those colors at that tolerance level so when we see it we'll be able to do that you could replace range uh let's see you can also replace range of colors with uh and another color paint range of colors with another color it's a range of colors oh like replace like you could replace them all with uh like you could replace them all with the target color or something like that so you could find like all of the near greens and change them to absolute green is that what you mean I'm not sure if I follow okay I will just load it on the pipeline because I do have one right here but which one is this is this standard no okay yeah this is mini about time for a desk cleanup it's probably past time for a desk cleanup if we're honest yes right right okay interesting that's a cool way to do it as well so you I see so you paint you mean paint like paint bucket fill basically because it essentially gives you that effect you could fill a region of near colors with a new color interesting all right let's grab the library again this one that on this device which is now the the pie portal oh but I didn't unplug the feather actually let me unplug the feather oh but now the pie portal is going to be circuit pie one here let me unplug invert we'll create masks of the non background create masks of the non background masks of the non background I'm not sure I follow that either but we could I'll try it out with true false I think that will probably make it easier for me to understand is this what is running here does this print anything oh okay oh I see it doesn't have the actual speaker hooked up I don't think I don't think well I mean we might as well I don't know if it's a simple test or if it was modified so it should fail the first time because I didn't copy the image I didn't copy the library either oh this one probably shouldn't be inside lib actually though let's put this out here cut paste it let it restart paste it pasted like gray ish why grayer than the rest of these like ever so light ever so slightly a darker color okay okay here we go I don't know what the colors are but it did run okay so we've got our photo of lars it's changing the tolerance down here and it's cycling through tolerances just counting by two which is giving us the ability to kind of see like once lars is pretty much cut out all the way then like that's probably the tolerance about where we'd want to use somewhere right around 350 ish I think it was so let's play with it a little bit manually let's just go pass on that one then let's go this one's a much broader range whoop uh oh we don't need this this one's a much broader range than the previous one the previous one we had a low tolerance like only four I bumped it up to six and then this one we're in the hundreds I think I saw it around 350 maybe 340 whoops wait I wonder did I actually set it maybe it's not actually so well yeah no we need to set this yeah okay let's do let's do this one here let me put that back also I'm gonna try it lower again update the tower grid to use this palette yeah okay so we got little bits of it taken out at 200 and then closer to around 300 we'll have more it's darn close there the only parts left at 300 are the shadow they're definitely gonna be the hardest bits for it to understand because they're the most you know the most different from the actual green that one's pretty good there's still a little bit under there lining up with about what I thought I saw I'm just trying to get a feel for like the different different values here we got some extra bits down there taken care of with that 10 I didn't update the I didn't update the tolerance on the label we could do that let's go for complete mistake tolerance value dot text tolerance into object has no find find what does find do on string is that a thing let's turn down find didn't know about that either so we're so close there okay let's try this with one of these also actually let's try this with one of these that is I still have one of these that is not rearranged it did right I mean I could run it again well actually I guess this one would be whoops oh this one has the crossbar in it too actually nice okay yeah that one's jumbled up it does look like zero is like pure green that's what it looks like to me at least the other thing that might be interesting is like I wonder if you target something in the middle like or if I targeted that one like that one maybe I could have a lower tolerance I'm not sure with the tolerance it's probably the same either way is it well no I mean if you pick the center of the range that you're interested in and you should be able to have smaller tolerance yeah that's probably the best way to go right is target the one in the middle so so so like the range of colors is like the brightest you know most vivid version of that color and then like the dullest is the one on the other end of the spectrum and that's the range you're interested in if the one you target is in the middle then your tolerance only has to get you halfway on each side but if the one you target is the most brightest or the dullest then your tolerance has to get you the full range am I thinking about that the right way maybe that's not actually how the math works out okay let's do give this one a try though so this this one's got it all jumbled up although this is probably too big isn't it yeah I don't think this loads let's generate a smaller one like 32 well like the this one is a 100 tall I think so see where we went down by 20 oh also though I want animation frames five they're way wider than they need to be they're actually like really wide oh oh the height was 100 not the width the width was uh the width was only 48 that's a little bit more reasonable we could uh we could tap the font size up a bit I think I know we don't like this these details don't matter for our test of the palette thing but I'm also working on creating the sprite sheet here as well to have one just to share for this library so might as well take a minute and get them lined up how we want being truthfully well the zero it's okay that's probably getting pretty getting close to about as big as we can do it we don't have too much more width for the zero I think else honestly maybe a tiny bit but what is static looking like horizontal bar is on the four but unfortunately it's a little too big isn't it was that by offset in a line color I don't think I did have a centerline size argument yet have it as a variable here or isn't it coming out to four pixels though play a half size coming out to three pixels oh okay because we we start it we basically go minus one for one side plus one for the other side I don't know what it will do if we put it on one will it actually be smaller to actually make it smaller with that math no that's smaller yeah okay one thing I noticed about this font papyrus or parchment is that it's a little bit weighted towards is it top or bottom anyway I introduced a Y offset here which allows you to move it a bit because it was kind of not quite centered initially so I figured this would be nice like some fonts might be further down towards the bottom or some fonts might be further up towards the top and you might want to like nudge it up or down by a couple pixels in either direction in order to get it to be how you want your flips to look um so I do think we want a little bit further back up I think right is this going which way does this actually go yeah okay 65k okay so we've got we've got full green at zero I'll get like a halfway ish nearby and we'll try targeting those as well I don't know if it'll actually have room so see if it's this or I guess we have plenty of room right it's got like eight megs yeah the room is actually not the problem the ram it was the problem not the room class calculates the differential so picking the center shade might help but not so not not significantly okay I'm gonna go top animation is it sheet top animation sheet I think so target color oh yeah actually you don't your target color doesn't necessarily have to be the zero index either nice though this one is taller right it's running off the bottom down there that's fine could maybe rotate it might fit but it doesn't matter too much truthfully and I wonder what the tolerance is like on this one maybe we should we put it back through the hundred is almost there not quite let's let it go back through it's uh this thing here put these back off do these oops oh why did that not oh I don't want this one still well that makes sense actually because the overwhelming majority of ours is straight green right we only have those couple of pixels around the edge that does make sense actually yes I think that's probably good 200 pull over 200 actually I'm gonna look at it straight on curious what let's see what the effect of I mean the second there is how do we out this oh there's a sort inside here and okay we don't have a great way to target the uh or to figure out what the second one is so I'll find like a middle ish maybe uh maybe one of these okay so then if we go with that one we can have smaller tolerance that looks like sweet spot between there maybe there's not quite a zone maybe there's not a good zone with this one okay it cuts both actually so the target one maybe that's too dark try this one that was right above it I think a little brighter that's a pretty good cut set go five to cut the gray if we go higher quite let's look at the let's look at the loop again on this one round 130 it takes out the bulk of the background but there is still a little bit maybe like one row of pixels there we cut that we're around 230 240 that's about like the hot zone kind of which was about the same yeah so it's about the same maybe it can I mean 210 gets us most of the way there so we can go a little bit lower but not that much like Seagrover was saying not significantly definitely one one gross sweet so this gives us a way if we want to do less work with our transparency less manual work of manipulating the palettes by hand which is awesome because I spend a fair amount of time going back and like reorganizing palette colors in order to make them transparent inside Circle Python so this is awesome thank you for making this and sharing it Seagrover I definitely will want to add this as an option inside the flip digit to where the user could well it kind of can just it'll work alongside the flip digit truthfully because the way that I set it up is the palette gets generated aside the palette gets generated at the user code level rather than inside so you could use this in conjunction and actually this library doesn't have to change flip digit will work as is because you initialize your images which means you get your palettes as well you make them transparent however you want and then you pass them in and then internally the bits that it does are the fader to go brighter and darker but the actual transparency is handled outside nice if there's no uh if there's no stage of green that you want to preserve then the target color is not critical oh okay I see if you wanted to keep some greens then going further away from it helps you keep them I see interesting okay that does make sense so then the green just targeting the base color like this probably makes the most sense and looks pretty good too I think these edges actually look better this one the right edges there nice it was 250 just 250 do anything else I don't remember what we had when we were like this it was 250 okay this is awesome try the fill color and invert yeah thank you I should do that let's go we'll set them up here right invert so let's try invert false well it was just on false let's try invert true okay I see keep everything except okay nice so you can do positive or negative basically that's really cool as well actually yeah basically that means it works for it works for both ways whether you're trying to cut out your transparency or whether you're trying well I said whether you're trying to cut out your transparency but it's really like whether you're trying to cut out your color or keep your color you can do it either way I see then fill colors so let's try like blue or let's try um pink capitals to match these ones but then this will replace it yeah so it is it's like bucket fill kind of like paint paint drop fill sort of you can and then it has a square here but my pink is already on top of it actually yeah this is this is really cool actually this kind of really gives us a lot of a lot of flexibility that we didn't have with display before or I should say it's not that it's not that it's flexibility we didn't have it's that it was manual you would have had to like manually set up your palette figure out your indexes and set everything this is giving you a nice quick easy to use api that is not manual at all you can just take your image whatever it is throw it on the screen try out a couple of tolerances find the one that looks best and boom you're done you don't have to worry about any kind of like palette manipulation at all you don't need to order it you don't need to shuffle it to put your transparency at the beginning you don't even need to know anything about the palette honestly because you don't target it by index you target it by color so like you don't you honestly you don't need anything you don't need to know anything about the palette and the palette doesn't need to be in any way specially prepared other than like you have to will have had a transparent color in it but like no other manipulation it simply needs to exist which is awesome that is really cool is there there's not a rotate is there what's the easiest way to rotate this there's not one let's see it's like roto zoom i think is probably the easiest and only oh well i could well i could rotate the display does that help us yeah maybe let's try rotating the display touchscreen color picker cursor oh interesting so you can so the user of the application could select the color more so than the like developer of the application interesting you can still see part of the repel behind here surprised by that i think maybe the size is different i think the size is making it weird now something with the rotation made it weird it's like it's still had part of the old rotation on it huh it's probably just because it didn't redraw the whole thing nice okay yeah this is amazing big thanks to see grover in the chat this i think really does like i said it was it's going to give us a lot it just makes it makes dealing with transparency inside your bitmap so much easier not having to manually move all of these uh palette indexes around and worry about all that stuff it makes it a lot more like i mean it's one step closer to p and g basically where it just supports transparency natively obviously we're not there yet but it makes it makes it feel more like that um even closer to that than what we have today so that is awesome thank you again for creating this and sharing it uh if anybody's interested in playing around with it i did drop that link in the github before eventually i think it will end up in the community library bundle potentially not there yet but it's up on github right so you can still play around with it if anybody wants to um and yeah i will set up some of the examples in the flip clock repo to use that instead of what i have today which is i think like range i did range zero to 11 for my transparent indexes but that's like 11 is just a magic number right i just had to look at the palette and find that and also rearrange the palette so that all 11 were at the beginning i don't know why i just put that in there i'm actually i gotta run and fill up my water i am super thirsty this evening for whatever reason so i'm gonna fill up my water real fast and then i'll be right back and we'll dive into some impui file size stuff so vrb yeah oh nice hand drawn silk screen fonts catany font okay there we go okay next thing i will get into is impui size stuff so this is something i started a little couple of weeks back let's go to cookie cutter cookie cutter this pr this pr is has the work that has been done so far basically for folks that don't know and and there are a couple streams that cover this a few weeks back so if anyone's interested in this stuff um and didn't catch those and want more of the background filled in you can catch those vods on youtube um and you can see when we were working on this before um this is basically a thing that will let a github action print a comment on a pr with the size of the impui file for that branch and specifically it will compare it to the current size of that library that way we can have a quantitative thing that says you know like if we emerge these changes then the size of the impui file goes from you know whatever 1.2 k to you know 1.4 k or whatever right like we'll be able to see those things print it out as a comment on the pr and it will happen automatically from the actions the specific thing that i am working on oh nice just one of the catney boards itc potentiometer i got one of those do i know mine's a yeah i do i have the oh no mine's a roadie rotary encoder not a not a um not a potentiometer rotary encoder i have i don't think i do i don't think it does say catney on there either unfortunately um so the specific thing to work on is the way it's getting the current size so i said it compares the new size or the changed size with the current size well the current size the way it's calculating it is not what we want so we talked about this a bit in the meeting last last week in the in the weeds i think it was so if anybody is also interested in more of that context i would encourage you to go back you can find the old meetings on youtube as well the meeting during in the weeds we talked about this a bit and jeff raised the idea of the way we're getting the current size is um by using the bundle which let's dive into the code a bit because it has size tools let's go here it's going to be a cool dev ops yeah data point in py size yeah totally agree totally agree eventually i hope to get to a point where we're importing on a device as well and maybe getting ram i think that would be super cool but one step at a time you've got to walk before we can run inside of here size tools it download latest bundle so this would be what it's using it's getting the current size from the latest bundle published version so it says download latest bundle download the latest bundle change directories inside of it so this must download it and unzip it then change directories to go inside of it change directories to go inside a lib create a variable because we need to handle single file npy files versus multiple file ones so if it so we make a variable for the single file we check if that file exists if it does we get the stats from it so we're just downloading the bundle trying to find this file if it exists we get the stats from it if it doesn't exist then we assume it's not a single file it's going to be a multi file and so in that case it is going to get the package name it's going to cd into the package name directory and then it's going to get sizes from directory dot slash which will add up all the sizes of all the files inside that directory and so the key thing right now is that this is downloading the bundle this says download latest bundle so that's where these are coming from these ones that it's comparing to we want to do something else instead of download the latest bundle we want to clone or check out the main branch build it as an npy files and then compare against that rather than whatever's in the bundle and so we think about it so right now the build of this branch comes from other actions see because we're using this so this is the bit working on checking the size for the current version the version that's been well not current i should say the changed version the version that's in the pr and it's actually just finding some built npy files that already exist they already exist because there's another action that created it firefox switch tab not deallocate i think i would like to see is having ci upload uh bin sizes onto a database with a board id and a get hash bin sizes on into a database the bin sizes of the um the builds inside the core repo you mean or do you mean library binary sizes and so one thing is there's kind of a lot of steps to building the current one so this is going to check out the current repo this is what builds it and so we'll actually need to do our well we'll we'll either need to add another step that builds the main branch or we'll need to do that inside of our stuff i think i lean towards trying to do it inside but it's also partially that i'm just less familiar with github actions because i did one thing i don't see is how does it know which branch it's checking out out current repo actions check out is this is this like is it built in to just know what branch can you tell it a different branch and can you give it like a directory or something because the thing is like if we check out like we if i check out main then it's gonna like change everything to be main i don't really i don't really want to have to change back and forth and i also don't want to break any of the other actions that are assuming that could be assuming the branch that it's on only a single commit is fetched by default for the hash that triggered the workflow set fetch step zero to fetch all history for all branches and tags doesn't look like you well this one okay this one does have a repository and then branch i guess can you give it a location can i like clone it relative path okay that's getting closer i think so this one basically is okay so let's see where did i i was trying these somewhere um it's been a couple of weeks though i'm not sure that this one was this one nice branch if environment branch ref equals main then i assume it knows because it's in the environment variables it's taking to the core mostly but library sizes would be cool too so this would basically give you this would basically let you have a list of all the boards that are supported and what size their binary is and then because it has get hashes you could presumably like see it over time or maybe over time is not the right way to think about it but like over code changes which happen over time that would be interesting that would also let us see if and which boards are very close to the limit potentially which is probably helpful information to know because right now it's like we go to add something and then like some of them are now over the limit and then we gotta go and like try to cut elsewhere to make room back okay so let's say name clone we're gonna say clone main branch main branch repository so that's where it gets weird because we want this repo but could we just not give it a repository and then it will check out the one that we are made the action from we could give it a path of main branch repo we could then give it a ref of main because it said that could be a branch thought it said that right the branch tag or shot to check out yeah otherwise it uses the default branch so okay the the default is github repo so that will check out this one and then ref we can tell it the branch we want so we should end up with a folder called main branch repo that is a copy of the main ranch main did I say main ranch I think I said main ranch right there unclear if it was for salad dressing or plot of land where they house cattle maybe a bit of both I don't know let's just see if this works because I don't like I said I'm not very like I don't have a lot of experience with actions I don't have a lot of like trust that what I'm doing is right uh test uh check check main check main run why does this happen LS main branch repo CD CD main branch repo is there like get uh get status get status yeah let's do that let's try this what are we missing files oh bundle stuff okay that's fair sizes this is one thing I maybe we want to do is we'll get to we'll cross that bridge when we get there one thing I'm not sure if this prints out anymore it might only go to the comment and we might not be able to see it in the actions output that's the case we might go back and make it so it prints out as well but explain what what you're trying to do again I am so right now well here I think this will make it easier to understand as well if we can see the old ones I did so does did this actually get to print all this stuff out so all these okay no not quite though because it doesn't have the comparison okay let me go here maybe okay yeah so these are the outputs this is what the actions command that we are working on will output um and right now what we have here is published version which is taking it from the bundle the currently released bundle and that's where it's getting these numbers from for the current version for I mean for the published version what we want though is we want this bit here to be main version not necessarily published version the vast majority of the time those two things are going to be the same thing like most of the time whatever is the published version in the bundle is the same thing that is in main but sometimes it might not be the case it might be the case that a pr got merged thus main has been updated but a new release has not been made yet or possibly a new release has been made but then but it hasn't made it into the bundle yet because the bundle also gets generated once per night so it could be the case that whatever is in main is actually different from whatever is currently as of right the second in the bundle it will probably catch up by tomorrow and be the same again you know if a release has been made or if not yet then probably it will catch up within a week or so when Eva makes the releases for us but for those scenarios where they might be different we want to be comparing to the main version rather than the published version that way we're always comparing the changes in this PR against what is currently in main rather than what is actually currently released already let me know if that makes sense and so then like most immediately I'm going to have it check out main see if that worked and then if it did we're going to cd inside of main and we're going to build the mpy files for main and then that's where we will get our main version numbers from and then we'll swap them out for the published version we push here and then we'll wait see the actions on pull there's actually two actions that trigger there's one for push and one for pull request and I guess pull request is the one we would want to be doing this on do we have any limiters I wonder we probably want to limit this to not run unless it's the pull request since this runs on push also I guess we wouldn't want it to run if it was just a push to main because there would be no PR to comment on we pretty much only want to do it on a PR I think see there is an mpy size of main the last release and the version in the bundle yep are you planning to store the mpy size in main or to calculate it again on every PR uh I hadn't really considered it but definitely where my mind was going was calculated again on every PR yeah I think that's what I lean towards because if we tried to like we we could calculate it and then check it into main and then we could just read it from there like an adjacent file or something but we'd have to make extra commits like after each merge it would have like a follow-up commit where it updated the size maybe it would be more efficient because then we wouldn't need to build main during the PR so that would like definitely cut down the amount of stuff the actions is doing it's an interesting idea actually storing it yeah I hadn't I definitely had not considered it what are these post post job cleanup it's new I don't recall ever seeing post stuff before huh so it didn't crash that's gotta be a good sign check main oh we should have I oh okay check clone main here we go check out repository config changes stuff counting from check out doesn't tell us much here as far as like did it go to the right directory just as far as I can see oh actually right there it does main branch repo ls main branch okay okay we got all these files we did uh get get status or whatever or unbranch main what did we have it do cd okay ls it cd into it and then get status it so this is all the get status and so it does show that it's on main nothing to commit all of that stuff makes sense so now inside of here well let's build we could build from here too right can we or no where is uh where's build in py build assets library location yeah we can where's it is it gonna build um hmm is it gonna build is it gonna put them inside the library the ones it builds or is it gonna put them inside the directory that we are currently in so I'll leave check main for now obviously we won't really need this one in the final thing but I'll leave it for now build build main build main what is this mad about scheme of validation required string actual object so here library location would not be dot instead it would be dot slash main would I say main branch repo or something yeah main branch repo main branch repo uh let's see caching it would use less actions that's definitely true although I think it if it isn't paying for that since it's all open source and public repos but it's consider it I think they pay github for something I don't know the specifics but I think they are a paying github customer I'm not a hundred percent sure so I reserve the right to be wrong I certainly could be wrong about this or really anything but I think they pay for something and I don't know if it's like I don't know how it works if it's an amount of hours used or if it's just like support or I have no idea but I feel like I recall somebody mentioning that they do pay for uh to like be an organization on github I think do you have to pay for that I'm not actually sure uh something like that though I think and then actions is like one part of it I would assume so we should you know what we should do though is we should move our check main until after build main that way we can see after it's built why does it paste like that high charm does not understand yaml very well this yaml yeah gotta work on that I'm gonna change this to look at just because check is close to checkout which is a get action which is not what we're doing and for a second I almost confused myself with it this one says check size as well but maybe we should do like size measurement measure sizes we still have check down here as well I used check quite a bit actually that's interesting we have nothing there is there any other kind of caching is there like is there any place it can be cached that's not inside the repo can like actions just cache some JSON data and then access it again in a future action without it actually being in the repo or would it pretty much have to commit it and push it into the repo if there's some like in between place where you don't have to make a commit but you could save it there that would be pretty cool because it would it definitely would be nice to not actually calculate it every time okay while this is running I'm gonna run to the restroom real fast because of all the water I've been drinking so I'll be right back again okay I also want to set up a locally hosted runner which we played with a little bit when I first started this as well because it'd be nice to be able to like get a look at what's going on inside the actions container more specifically all right so here's our build main deleting existing build yeah so that I think this I think this deleted the I think this deleted the one that got built before so build assets here this generates this generated this and zipped it I think this deleted it this is now saying delete existing build and this is the same directory but probably a different commit I guess right isn't that a commit hash maybe not 909 now that does say the same this is quite a few times this is kind of odd I am surprised this is the same shouldn't those be different and it doesn't have they're not inside of here but I guess what we want is maybe do this you cd main branch repo and then this is actually going to be back to dot what was that 909 that's actually not any of these commits is that the current what's that line behind or something it's different you could run any script you want I think the right place to make it happen would be inside the build tools I'm not yet sure where to store it I can't think of a reason to not commit it to the repo um mostly I'm just scared of having the actions like make a change and commit it because if it goes wrong then it might like delete something or add too much or do something weird I mean I guess we just test it and try to make sure it doesn't do that but could have artifacts artifacts would be interesting we use artifacts for the builds I think workflow artifacts if those can be accessed by a future workflow that might be a good candidate I mean the the other thing with the committing it is then essentially every commit becomes two commits or every pr becomes an extra commit which I guess doesn't matter right commits are free it doesn't really matter how many we have so maybe that's not a problem artifacts does seem like an interesting idea though if that can be accessed from the next one you can download it okay so we could post like a JSON file into the artifact and then we could download it now artifact so are these per branch or per repo or all artifacts perhaps we haven't managed to crash one of these yet honestly so this one did its thing build its stuff one main branch build main cd yeah see this time we don't have the deleting okay and then this is okay yeah we actually do have two different numbers now as well hashes so this one which should be the changed branch is 2a0 and then this one which should be main is 093 makes sense for main this one is 403 I don't know where we got the two 2a0 maybe those aren't commit hashes I assumed they were maybe they're not 2a0 or did we get do we already have multiple commits no I have a 2a0 I don't know where that came from for a github action run but I don't see download this one yeah the official one doesn't support that there's an issue for that this does actions download artifact I see download this one should download artifact so yeah I'm not I'm not sure about this hash that seems odd to me I don't know where it got where it got that but but as I understand this should be the one that's building the branch from this PR this one now looks to be building main and if we look inside of here now we have these which is perfect inside of these it's going to have the MPY file that we need to use check against so inside of here nope we don't have it open actually okay let me open it probably not gonna be in recent well it's in there somewhere but size tools so this is gonna now be main version branch version download latest bundle so we're not gonna we don't need to download anymore honestly it's gonna behave a lot more like this one here's our is file this will look in the current directory to find this file okay so before we do that we want to go os.chdir main is it main repo branch main repo branch is that right yeah no main branch repo okay CD to there then find the version 8 MPYs go inside there go inside the first directory you find go inside lib then do basically this stuff but this would be main branch version and the good news is like this is all the exact same stuff in the other one so besides the output I don't think much else needs to change and this does need changed version size changed version size strings curve version size oh okay so where we do these we actually want curve I should probably change it to main version instead of curve version but string file okay um let's say change to compare with main branch instead of published received two 10 000 mAh batteries got a possible hurricane headed this way and starting to charge up everything yikes good luck I hope it doesn't get too bad out there every rat hope your batteries get charged up and get you through as well it's definitely nice I got a big battery bank and it's definitely nice when the power's out to still be able to do some stuff okay so that is now pushed we pretty much need to make another change here though and push it that way we'll get the actions to run again let's comment that out for now you know one thing else we probably want to check is like do we need to cd anywhere else because oh okay no this is already original working day this is already gonna change us back okay nice nice nice nice okay that stuff doesn't matter I'm gonna leave that we'll commit it again later I wonder if those push actions are failing so find out when I check my email after this I think it sends me an email for failed actions 10 k batteries are brand new products max used to be 6600 oh nice that's like another 30 3400 that's pretty good size increased 30% I did to try it out with my weather station I'm sure we'll get some work this week logging everything data for dayo as long as I have Wi-Fi anyway it's to log to your phone as a tether yeah that's true yeah tethering your phone to have stuff join the network is pretty nifty it's definitely helpful sometimes especially if the power is out and therefore the internet like Wi-Fi is out then cell phone network is definitely super useful you have like an sd card or something in your in your project you could cache data to that as well and then even if you had no network connection it would still be inside your local file you could either like upload it after the fact or be able to look back on it uh-oh this time we failed no such file I guess it's because it was cd'd into the wrong place right it was cd'd into wherever this left it so this won't work we need to go back to uh we need to go back to the root which was that original I think right original original location or something did we actually get that from original working dur yeah oops there first so that xd card in is a great idea I haven't set that up yet have an sd card on the feather wing though nice oops I should have uh changed the commit message but I'm gonna close this one and this one probably close device workspace as well but this will at least make it so it doesn't have to scroll and then I guess I don't know we'll comment this one more or I don't know oh that uh is the youtube oh no the discord is running off the screen too oh goodness didn't check my uh preview well enough today okay it's the youtube super tiny that's just my preview pretty tiny let's make it okay there's a little bar there that's like the top margin we could try to cut that out as well but I'll jack with that later I don't want to do too much inside OBS while it's running I think that looks better I'll have to uh yeah I wonder if there's like can I set a default I'll have to try to remember to uh-oh where's the rest of our stuff oh I don't know something went wrong here because this is also pretty much current version instead of instead of main well that main and publish but I mean in this case main and publish probably should be the same hmm so what was this was okay output string uh yeah yeah yeah we need to not do that I guess we probably want this still and then this should be plus equals um why is main that different than published though published we had only 766 the main is bigger 25 days ago 28 days ago so I guess though in my case main could be behind maybe my main is behind I think Adafur Dio has a way to import a log from an SD card well you can write the code though right you can write code that loops through the SD card and then uploads it to Adafur Dio definitely not with Whipper snapper yeah that one I definitely know less about I've only done the most basic with Whipper snappers so far I'm using as your name main real-time nice to temp this too for the temp sensor and TFT feathering too many projects yeah it's not a problem though too many problems too many projects is a good thing lots of projects is a good thing okay so we pushed our size I think so it would be checking out foamy guy main I think right it because it would be checking out the branch that spawned it and in my case or is yeah okay but yeah mine is is a while back still so maybe my main is behind slash wrong I'm gonna go foamy guy main merge from Adafruit main push this gets foamy guy main caught up then we go back to here maybe we should have it output this hash as part of the comment so yeah I think when you upload it using MQTT it'll give data points with the wrong timestamp it only works in real time can you specify a timestamp in the JSON uh that I'm not sure about but I mean you could always yeah I don't know if there's like a built-in timestamp it may be automatic you could make another field or whatever and submit your own timestamp yeah if there is an automatic one you may not be able to change it I'm not I'm not too sure if there is or isn't I also have only limited experience with Adafruit IO more generally too I've done the most basic stuff with whippersnapper done a little bit more Adafruit IO but not that much truthfully I don't think I've even ever done any sensor readings to Adafruit IO the stuff I used it for was like pushing a video not on a video pushing an image to it and then showing that image on the screen uh in typical Omega fashion is that for showing stuff on the screen but it didn't fail this time this is now different 629 okay there's our output so the changed version here is I wonder if we should print the difference I mean people I guess could do the difference themselves I don't know it's the difference nice to have maybe it is same just with basic stuff whippersnapper I use MQTT and JSON manually on the S2 to get it working then moved it to another project so this one was basically not quite a hundred bytes maybe like 60 or 70-ish bytes bigger the strings though actually are a larger percentage so it almost looks like it looks like pretty much all of the bytes that were added were strings because yeah because that's like that same 70-ish added to that interesting yeah I wonder if we want a third section with like summary or conclusion or something where it it could do the subtraction to say like additional size with this branches x bytes additional string sizes x you know whatever this the percentage I mean I guess it could subtract the percentages as well we'll see maybe I'll ask for feedback on that on the comment I don't know if it's worth having it print more or if it doesn't if it's not worth it because it basically just the numbers that are already there doesn't actually give us new information just puts it into the comment for us I do think that worked though I think we could take this out and then we could basically go back to cookie cutter put in this new stuff having the difference done for people to be helpful I don't think this works but we added we didn't change this because all that logic lives inside of here so really the things we added were after clone size tools and before check sizes clone main branch build main branch supposed to be so which are stand if we wanted it to comment this would be in here we'd basically go we should store the percentage there we go and one more this one down here now we have those as variables so then after this kind of stuff we could be doing output string plus equals another one of these summary and py file size difference changed version minus cur version and py strings size difference changed cur py strings percentage changed eventually we're going to remove all this stuff I'm going to leave it so for right now but add summary section size comment differences okay so we removed that so we should pretty much get the same numbers as last time but with the summary why are you spilling all over me water and I think I'll be heading out here pretty soon so thank you again to everybody for watching I will watch this one to the end we'll see if it we'll see if it's working or if we need to tweak anything I may make the tweaks but actually once we get this one printing the summary section here I'll probably be turning it in for the night so if anybody has any last minute questions or comments or anything else that you would like to share or say now is the time to do it and beyond that we will hang out for a few minutes and watch the actions here and then call it a night I got to say definitely thanks again to see Grover for that palette filter I think that's definitely going to be a super cool utility for display oh I think that makes a lot of stuff easier for us so thanks again for sharing that and sending me the link to take a look at yep you do the same as well DJ Devin have a good night to you and everybody else who's watching yeah for sure let's say quite a while huh okay there we go finally you just got to just got to say something about it it's all it knows it knows got ears ears everywhere pre-commits I don't think I haven't run pre-commit for a while I guess I've been passing though right that's a good sign oops thanks for the stream good to be watching yeah for sure thanks for watching definitely appreciate you watching hope you have a nice night as well uh Harold got here building assets so that's the changed version I will say the uh while it would save us some time to not have to build main honestly it doesn't take hardly any time at all one second only for the build I'm surprised it's not longer truthfully though okay I think we're looking good let's head back to here there we go PY file size difference was 69 this dream's difference was 73 we didn't round our percentage let's do that the same way we did the others I haven't been running pre-commit on this got some line too long those to take care of yeah for sure thank you uh see Grover happy to happy to tinker around with it take a look and definitely looking forward to using it so store percentages and variables what else do we do oh output the summary add summary section I guess we already had the summary section didn't mean we just tweaked it a bit we did um yeah some of this stuff is old actually we did round round uh summary percentage two places to add the percent sign that's relatively minor and then code format yeah really those are the only two things we did but format makes it looks like there was more changes than there were but it's all right about summary wrong oh well it's forever etched into the commit history now so yeah this is odd to me that these are different right does that make sense that this could be different that feels wrong doesn't it oh tim hope you're having a good day yeah I'm I am I hope you're having a good day as well I'm gonna be heading out here pretty soon but I think thanks for uh thanks for watching and mentioning that Roy appreciate that um couldn't these be the same or or if not the same shouldn't the file size be as big or bigger than the strings size it's not that simple because it feels like if there were 73 more bytes of strings wouldn't there have to be at least 73 more bytes of total size because the strings are part of the total size it must not be one to one like I'm thinking there must be some cases where the things inside the strings output are actually slightly bigger I guess than they end up occupying in the final file that's the only thing I could think of they could cause that but all right I think that's where we will call it tonight we got our summary print in there I did go back and make the change to truncate this to two percentage uh decimals like these ones are and also add the percent sign but I won't bother making another commit for that right now only other thing really to do still would be to commit cookie cutter and I'll hold off on that I think what I'll do is when I do test this I'll test it another time to get another printout with the updated percentage year and then once that's done I will push those commits to cookie cutter that way I can link back to the comment that has the latest stuff in it in that cookie cutter pr and I'll probably end up doing that tomorrow during my stream that's my guess as far as right now at least so you're interested in seeing that or seeing the continuation of this project come and join me tomorrow morning on my stream you can find it on foamy guy underscore twitch or if you come to the live broadcast chat which is the discord chat that's on the screen down there then I'll put the links there in the morning that's tomorrow morning at 10 a.m central time so I'll be back working on this stuff again I think I will see if tomorrow brings anything different as well I may branch out into some other things also but I'll probably start here so that's what we've got for now thanks again to everybody for watching I do hope everyone has a good evening yeah again definitely appreciate everybody purchasing hardware from Adafruit thank you to Adafruit for sponsoring myself to work on circuit python as well as paying the rest of the team of folks who work on it so huge thanks to them and thank you to everybody for watching