 If you haven't watched a deep dive before, make sure you check the notes after the fact. If you're not watching live, of course, there will be time codes down there that let you know when the interesting stuff happened. This tends to be kind of a long... Oh, I forgot to make the YouTube larger. Tends to be kind of a long thing, so check the notes for time codes to make it. To make it so you don't have to watch all the two hours if you don't want to. Yeah, well, I'll just hang out. I'm starting right on time, but we'll wait just a little bit to get going here still. And I'll say hi to folks, and I need to actually make sure that I did everything. Yeah, it looks okay. It looks like I got everything. I think I have to pause my YouTube stream as well. All good, everyone? Hi, Minnesota. Mentat. Hello, Dave. Hello, Beata. Hey, Johnny. Hey, David Buchanan. Mark Tomlin. Ooh, got a frilly just in time to catch the stream. Thanks, Mark. Hi, Keithy EE. Hi, Doctor. Hi, Gary Zee. Love the factory. Hello. Doctor again. Hello, Mark Gambler. Hello, DCDE. Sorry, you're in lockdown. That sucks. Hello, Hugo. Hey, Johnny. Hi, Mr. Certainly. Hey, Kmatch. Awesome. Hey, Jonathan Turner. I did get... I got my second dose of the Pfizer vaccine on Monday, which is exciting. So the clock is ticking until I'm officially fully vaccinated. For those of you who aren't there yet and may be a little hesitant, I would encourage you to do it. My experience after the second shot was that my arm was sore, like the first one. I did not get a red spot like I did from the first one. And then on Tuesday, I was pretty tired. I didn't sleep that well. But I think it was due to the shot as well. And then I felt like I had exercised, which the exercise I do doesn't really make me sore. So I had a little bit of a muscle soreness from it as well. But then I woke up on Wednesday and felt real good. So not too bad at all. Finally some sun and warm weather today. Yeah, it's a little deceiving, though. I just opened the window because I was worried about it getting hot. And I'm getting this like a little bit of a chilly breeze. So it's not summertime yet where it's like super warm. Hi, Bruce. I don't think I said hi to you yet. Hey, Andrew Reid. Oh, interesting. Mark Gambler says, I did sign up for a study on mix matching doses. It will get me the second shot sooner. Yeah, I'm curious about that. Obviously, they haven't done a lot of studying of that yet. Mark says, the day after the second dose, I wanted to sleep all day. Highly recommend people take the day after off. Yeah, I just, I didn't take it off. My partner was saying earlier she wasn't feeling spectacular this morning. She's like, today's the day I would work from home. But I'm already working from home. So what do I do? Doctor says, I basically felt dead like migraine plus bag cold after the second one for a couple of days, but then felt fine. Hi, Les Samoais pour près, slipped sick and slept for most of the two days after. Yeah, I think that's pretty common for folks to just feel a little sick. Bruce says in Canada, they may be mixing up the vaccines because they can't be sure what they're going to get. Well, good luck. Oh, I missed the restream folks. Let me check out the restream folks here. The folks in the Twitch chat, I should say. Mr. Certainly is there and Natish 1764 is there. Sorry, I missed it. The chat was underneath my OBS window. That's why I missed it to start. Now I can see you. All right, so let me do housekeeping and we'll get started here. I think I've got, well, let me check my window. Yeah, my window is a little too tall. There we go. Yeah, the Twitch chat's not on the screen, but I do have it up on my. It's not on the video, but it is on my screen, so I can. I'll see it now. It was just under my window. It's actually usually not the active. That's why I missed it. Oh, and you know what? Okay, for real now, I'll stop messing with my windows. I always start writing my notes in the wrong doc. All right. Hello, everyone. My name is Scott. If you don't know, I go by tan newt online and I'm paid by Adafruit. Hello to Shippu. I'm paid by Adafruit to work on Circuit Python. So if you don't know what those two things are, Adafruit is an open source hardware and software company based out in New York City. They have a number of folks that work remotely, though, and I'm one of them. So I live in Seattle. I do software engineering for them. So I'm more of the software side than the hardware side. And I do Circuit Python. Circuit Python is a beginner friendly version of Python designed for little inexpensive computers called microcontrollers. Let's see. Here's an example. This is a feather. And to read it, M0. And the larger black, those are called chips. That's the little computer there. This one runs at 48 megahertz, but you can get some that have more RAM or run faster as well. But they are very inexpensive, so they're like under $10 of people, so a people, a chip. Under $10, maybe even under a dollar. So they're really affordable. They're a great way to get people started into computers. So today, this is a deep dive. It happens every week on Fridays at 2 p.m. Go for about two hours, at least two hours. We just talk about whatever, so questions are welcome. It's normally this time 2 p.m. Pacific. We do shift it on Fridays if I'm doing something on the subsequent Friday, but I have no plans next week, so next week we'll be out Friday as well. If you want to chat with me and a lot of others outside of the stream, I would encourage everyone to join the Discord server as well by going to adafru.it.discord. And last up on the housekeeping is, in the shadow here is Spook. He's one of the two kitties that we own, that's why there's two beds there. He is epileptic, so occasionally he has seizures, but he's been doing really, really well. So I wouldn't expect it to happen, but it has happened in the past. So just to heads up, if I'm streaming but not communicating with everyone, that's probably because I'm just making sure he's okay. But he's been doing really good. Since I started streaming, we've switched as meds, and the new meds have been working really well. So very happy with that. And once I'm fully vaccinated, and my partner's fully vaccinated, we're going to go visit her family as well. So they'll get to spend some time at their vacation home with my parents here in Washington. Had a doggie day today meeting some friends' dogs. Nice. Hey Paul. Did I say hi to everyone? So let's see you here. I got a bit of an agenda. So last week, I think we were working on, or at least in the past few weeks, Minnesota Ventette says, heart and appreciate all that merging work. Thank you. Thank you. The merge is done. It's in. So give that a shot. Please help us find issues. And hopefully we can get to 7.0 real quickly. And T says, I like non-active streamers. Yeah, I do kind of at the end, like if I'm getting in the zone on something, then I tend to communicate less. But at the start, we usually are answering questions and stuff. So the MicroPython merge is in. I have some stuff that I was supposed to do for MicroPython, but I haven't gotten to that yet. I really, I need to get this BLE workflow stuff done. Bruce says, supply and text 4 is out. I saw that I could update it, but I didn't update yet. I needed to, what was I thinking? Oh, I didn't want to update right before this stream. Kmatch has a hunger port here for Mark saying, thanks for taking on the ESP32 S2 spy display speed updates. Doing some house bathroom demolition this weekend, but can probably find some time to test in the evenings. So Kmatch and Mark have been doing a great job. We had some issues with the fun house where people are seeing artifacts on the screen. And I think they kind of figured out that the issue was is that we're not, you have to send commands slower than you can send the data. And the display IO currently doesn't distinguish to the two. So I'm excited to do that. Before I get to this question from George, I just wanted to say that the status LED changes were merged in today as well. So that's cool. Please test that as well. I think Neridoc already found an issue on a couple boards. So thank you to Neridoc in advance for getting a PR out. I think I saw PR goodbye for fixing those boards as well. I appreciate it. OK, George says, would you consider yourself an IoT slash embedded systems engineer? I do. I would consider myself an embedded systems engineer. I don't think I would say IoT. I think IoT is it's kind of unclear what side of IoT you're on. There's a lot of work with IoT is around security. And there's a whole world of like, what do you do when you collect the data that I don't really deal with? So I would consider myself more on the embedded side of than the networking side. And I kind of like if people have seen like I don't really enjoy working on networking. So yeah, Bruce says I lost all my keyboard memory using VS Code now for years. Oh, I did like sublime text. Yeah, I'll have to take that. Oh, maybe Neridoc didn't do that. PR for what now? I thought you had a PR for fixing the Neopixel power on a couple boards. But maybe I was wrong. Oh, Minnesota Menta says, what was the issue the issue last week about LED? Yeah, I believe so. Yeah, other folks tested it for me. And the reason I wasn't getting red was just because I it was broken. Doctor asks what's and actually I mentioned it to Lady 8 and Lady 8. I said, yeah, like red breaking is pretty common as well. Doctor asks what sublime text sublime text is an editor. It's a text editor usually used for code. Johnny says, IoT is cloud plus embedded. I have built a commercial IoT cloud. Nice, they are not properly configured. Yeah, I figured that. Thank you. I haven't updated sublime text yet, but I will. DCD says, speaking of networking, the show and tell Bluetooth file I was impressive. Yes, we're going to talk about that. Jonathan Turner says, is there a way to import live folder modules? Folder modules from the REPL from the REPL on the device, not usually. Well, what do you mean by import? If you're in the REPL and you have a file in live, you can just say import the file name. But if you mean like downloading the modules like from somewhere else onto the drive, you can't do that from the REPL. So, Jonathan, I'm not exactly sure what you're asking. Doctor says, how come red breaking is common? Do we know? I think it's somebody mentioned it last week about the different forward voltages of the different colors, I think. Mark says, I'm about to implement a TCP stack in Rust. I'm terrible at TCP, so this is going to be an adventure. You should check, see if somebody has done that already. I wouldn't be surprised if they have, if they have already. The Rust people love Rust. George says, thanks for the response. I'm working on a Bealeen medical device and would like to reach out to you about some roadblocks that I've encountered. If you want to get help with anything, I would suggest go in the Discord server is a great way. There's a lot of experienced people there, so that's the URL, adafru.it slash discord or you can post on the Adafruit support forums and get some help there, too. But if you need a contractor, I'm technically a contractor, but I'm also technically like I'm all booked up. So I can't can't do a lot of help directly. David G asks, could there be an editor in the REPL to be able to modify a Python file from the console? I think so. I was thinking about this a little bit and I know Kmatch just thought about this, too. This is something that I've thought about in terms of the like run circuit by on a Raspberry Pi. And I think the answer, I think this the the. Yeah, full-time Adafruit contractor. Yes, I think that the editing on the device itself. The the oldest PR we have open is setting what file to run next. And I think that's kind of the key piece that you would need to be able to like swap between running editor code and user code and back and forth. I think that's one way to do it. So, yeah, it's exciting. All right, we're cruising. So I just wanted to do a quick detour away from circuit Python before we get into the weeds. Oh, he moved to the sun. Can you see him still? I must be doing something wrong. I seem to only be able to get core modules. Otherwise, it raises an import error. Yeah, so make sure that the like what I would do is hop on the discord. Take a screenshot of the layout of your files, because the layout of the files actually matters. Yeah, so I would hop in the discord and folks can help you figure that out. Um, it might be like the file path is a little weird, that sort of thing. I've Ava Mander says, I have missed a few streams. Is there an Adafruit BLE file system protocol out there by now? Or have you solved the issue of managing BLE device storage? Yeah, let's just skip to this. I wanted to talk about my fiber stuff, too. But actually, let me it's going to be really quick if I talk about this fiber stuff. So let me just show you kind of where I just wanted to shout out this really cool project I found this week, which is just a little bit too. So briefly, I've been working on this map for fiber availability in the US because we're going to be spending a lot of money on it. So this is the latest version. You can go to fiber-deserts.net and you can hover over it. And what I'm doing now is I'm trying to work on changing the hosting. This is all GitHub pages hosted right now. And you can see that you can hover. These are census blocks, which is the unit that the FCC manages communications data on. So what I'm trying to do is I'm trying to scale this up to the US. And Hugo, thank you for the link there. We'll get to Belian just a little bit, but I wanted to just say a quick shout out to this project. I've been working on it a lot. I'm very excited about it. But I found this project called Dataset that's not spelled quite like you would think, but it's very cool. I would suggest people look at it if you've ever kind of been in this like I want to host data sort of mentality because it looks really, really neat. So what it does is it statically hosts a database by having it just be a SQL lite file. So SQL lite is a SQL database, but it ends up just being a file on your file system. And so what it does is it takes that like single SQL lite data file and like packages it together with a bunch of HTML and JavaScript and then kind of statically hosts it, which is really neat. So that's been really helpful. And it can do it, there's like a published command that just pushes it straight up to the Google Cloud stuff. So this is really neat. Let me just, I could do a super quick demo because it is really quick. So I've got, here's my working directory. And let's see what I've got a number of databases here. So I have this like form 477 mobile DB. So I can just do data set, form mobile seven, and then I set the time limit higher and I just run it and it gives me this webpage. So this is kind of like all out of the box. So it shows me like here's the database and here's the tables in the database. And if I click this, it shows me like all the rows of the database. And I can also say like, oh, I just want like if the state is Washington and then hit apply and it'll give me, it's a little slow, but it'll get it. There's no index on the state column. That's why it's a little slow. So this is giving me all of the rows for Washington. So DBA is like who it is. So like AT&T or Sprint or T-Mobile. And what it's, what these numbers are the different cell technologies. So like LTE would be one of them and it tells you the percent coverage that that carrier provides with that technology for a given block. So yeah, it's really neat. This is kind of my plan moving forwards for the fiber desert stuff. So I just thought people should know about this cool project. And that's kind of where I'm going with that. Once I get, I'm trying to like process more like census block data for all of the states rather than just Washington and hopefully ending up with something similar to the original fiber desert thing. OK, that's my quick detour. Open source. Yes. Dave says, is it open source? Yeah, data set is done by one of the one of the early devs on Django. So it's all Python under the hood, which is really cool. So it's really, it looks really neat. And it when it pushes to the cloud, what it uses Google Cloud Run, which is Google Cloud Run is isn't a VM instance, but the instance only gets spun up when people access it. So like for me, where it's like, I'm going to do this project, but maybe no one will ever visit it. It's really nice because it means that like if nobody's visiting it, then it doesn't have to it doesn't cost me any money, which is really neat. All right, cool. I just thought I'd shout that out. It looks like a really nice project. And you're welcome, Gareth. Gareth says, nice looking tool. Thanks for highlighting it. Yeah, I've been pretty excited about it. It actually, I need to try getting changes accepted upstream. I haven't tried to do that yet, but OK. Let's get back to Circuit Python. So it costs you the most money between 2 and 4 p.m. on Fridays. Well, it's not running on that yet. It's running the current the current page is just on. The current page is just on get pages. Yeah, we'll see. I I do need to add support because data set can host NB tiles like map tiles, but it only supports PNG ones right now. And I've got vectors, so I'm going to have to fix that a bit. OK, let's get back to Evander's question. So Evander said, have missed a few streams. Is there an Adafruit BLE file system protocol out there by now? Or how have you solved the issue of managing BLE device storage? Yes, I have a protocol. I think it's kind of good enough for V1. If you want to see what it is, you can go to this URL. It's Adafruit GitHub.com slash Adafruit slash Adafruit underscore Circuit Python underscore BLE underscore file underscore transfer. And there's a big note stock here. And I'll just leave this open because it might be really helpful. So there's a list of commands and it tells you exactly like what the protocol is for reading a file. And we're hopefully going to get to this today. Ah, Keith E says, it's extra cool to see this since my brother is an aide for a legislature and is helping with a bill associated to ISP speeds. So thanks for sharing. You're welcome. That's kind of the goal. The goal of the fiber deserts thing is to really like highlight areas that need fiber access and highlight the money that we're already giving to areas potentially for not even fiber coverage that we that we were in my opinion, wasting in other technologies. DCD is on top of things today. OK, so update on the BLE stuff. So talking we talked with Antonio. We've been working with Antonio. He's a contractor that we work with for iOS and Android development. So there's two videos I wanted to show. Here's the first one. These are both from iOS. And I'm going to confuse you a little bit later because I have an Android plugged in. We'll see if we can get that going. So let me just play this video here. It's only like a minute or 20 seconds long. So this is just a test app that the Antonio made to do the file transfer stuff. So you can connect. And then it just kind of has pre canned like contents for different things. So reading reading files from Circuit Python over BLE, writing them back, clearing and then reading them back as well. So that's all it is. It's super basic right now, but it's like just testing like the under workings of doing the transfer protocol. And it is talking to a circuit Python device, but Circuit Python is running the prototype that's in that repo that I pointed out. It's not running like native Circuit Python, which is actually what I started working on yesterday because this is really exciting. And it'll make it'll feel so good when when the dots are connected. So there's one. And then I thought I'd just show this other one as well. In case you haven't seen it, let me turn the desktop audio on. OK, Lady, what is this? Hey, I'm testing out our new build of Glider, which is an application we're going to use to be able to send data from an iOS or Android device to a Circuit Python board that has Bluetooth and energy support. And because Circuit Python is interpreted, it means that we could have this code here, this this text area could have code in it. And then we write the file here and it gets transferred almost instantly over to the application. So our idea is that you'd be able to write code on your phone, your mobile device, and then transmit it over to Circuit Python board to be interpreted immediately so you can code without even needing a computer. You can code with any mobile phone or tablet that has VLE support. So clear that text, clear it. OK, let's read the file back. There you go. So now it's reading the data from. So writing and reading. We're going to have directory management and deleting files next. Oh, yeah. So that's the demo that Phil Memorial did. And so I think the plan is to have two. My goal that I'm pushing us to have is two apps. I believe there is a new Glider repo. I think I got an email saying that there was. Though the archived one is my version of Glider. Yeah, so there's Glider dash four dot dash iOS and Antonio dash open road is the is Antonio's GitHub handle, at least for it. Open road is the name of his consulting company, I think. So my goal is for us to have two apps. Since I'm not paying for it or whatever. But I think it's it's really important for us to separate kind of what we're doing. Like I think Glider should be our here's an app that just pushes and pulls files over really. And that's really useful for a lot of projects, right? Like that's not just it won't be circuit Python specific. It's just about like I want to get this file over or want to read the files off. And then what I want to do is. And then we'll have a second app, which I think we'll use the pie leap name for, which is like file management, but specifically for circuit Python. So we could do all the bundle stuff. We can do the upgrade stuff. We can do like code editing all in that app as well. Mark says right now it's running as a prototype as a CP script on the chip. Gotta say that's one of the more really remarkable things about circuit Python. You can do some really complex stuff in it before it's native in in C land. Yeah, totally. The one caveat is that the prototype is not actually writing to the file system. So like transfer speeds might be a little bit of a misrepresentation. The contents of the files are just stored in like a dictionary. But it's really been handy. Like I got Antonio, like we have prototype code for both sides. And he said that like as he was doing the iOS stuff, it was really handy to take a look at like the client Python code that I had already written as well. And I'm going to be using that as a reference in the C side of things, too. OK, so. What else was I going to cover? So what I was working on is we actually in circuit Python. So this is circuit Python as it is now. Let me close this. So this is a file that's been in circuit Python for a while. It's circuit Python's supervisor shared Bluetooth. And let's just look at the history of this file. I was actually working on it in October of 2019. Um, Mark says on the Rp 2040 queues, by how fast do you think those rights will be? Well, Rp 2040 does not have Bluetooth. So this will not be on Rp 2040. But. Generally, the the bottleneck for writing to flash is a race time. It's not actually the right time. It's the race. So that's what that's what it is kind of usually the bottleneck. Ah, Evander says, by the way, the reason I asked this is because the pine time and its firmware efforts have a similar problem. There's a need to easily update resources on external storage, having more than a few implementations and a more common protocol are out there will be quite great. Yes, please let them know. And I'd be happy to chat with them. This is exactly kind of why I want us to have an app that's agnostic is exactly for this reason. Like there's other people that will use it. Like there's a BLE, like the Bluetooth people have an object transfer service that uses L2 caps as well. But one thing I wanted to do with this transfer service instead was to make it really simple. So we don't use L2 cap. It means it's going to be slower than like the optimum speed. But it's a lot simpler to implement. So I would love to see somebody else take a crack at it and get some feedback on it. But there would be nothing like we're not going to make our app not interact with somebody that would like somebody else's device that says that they have this service. So that would be perfect for it. That would be really cool. And in fact, I have a pine time in my thing. So I have wanted to get circuit Python on the pine time as well. It unlocks a number of devices for a circuit Python that we currently can't access. Love the factory pointed out this would be nifty for replacing animated gifts. Yeah, exactly. David says, let's do a new standard XKCD reference needed. Yeah, see, I am I am definitely in the not invented here camp. I am totally guilty of making new standards, but I also feel like a lot of times they're for a reason. And I don't think that that XKCD necessarily captures that, right? Like the reason that I want to have a different file transfer, something is like it needs to be simple. And so, yeah, I looked at the other one and decided it wasn't simple enough. Yeah, Hugo says, wasn't there another file transfer over Billy that was out there? I think David shared it on Twitter. There was there was there was a the Pete Warden who does the Pete Warden who does the tiny ML stuff had just posted an Arduino Billy file transferry thing using web Bluetooth over. And I asked them for feedback as well to unify it. They basically said, like, yours looks more thought out. We'll just switch to that in the long run. So yes, that is pine 64. As pine time is what we're talking about. Yeah, it's a watch from pine 64. Mark says, in a feather stack could a Bluetooth feather wing on the RP 2040 feather and get access to the implementation with that work? It's it is not a priority for me to make it work with an external thing. I've pushed really hard. If you want Bluetooth, the RP 2040 is not the right pick. I'm sorry. The RP 2040 is great, but it's not great for connectivity. Like I'm not. Yeah, there are very few things. I think where you actually need the 2040 and Bluetooth at the same time. I've been I've had I'm a little not not the most. Yeah, sorry. Sorry if I'm coming off a little bit aggressive about it. It's I've heard this argument over and over from someone and I keep telling them the RP 2040 is not the right chip. It is not the right chip for what you're wanting to do. And they keep saying, but I wanted to work that way. And I'm like, you don't need it to. You don't need the RP 2040 for what you're trying to do. You could also run circumvival on a lighter light V4 with us. Interesting. And I haven't looked at the lighter light before. What chip is on there? Bluetooth 2040 will be a beast. I mean, the thing that I'm more interested in is like, if you want a beast, like like the NRF 5340 is their newer chip, right? And it's a dual core ARM Cortex N33 with one mega flash, half of mega RAM, still 64 megahertz, but and don't have PIO, but like if I'm going to bring it to a new chip, this is the chip that I'm going to use. Like or the the chip that's on the actually I take that back, the chip on the micro bit is that micro bit V2 is the NRF 52 833. So awesome. Just got a text for a friend. The RP 2040, isn't the hammer to all these tables I'm trying to use? Not always, not always. The lighter light V4 is an NRF 52 and an FPGA. Interesting. Doctor says me. I say RP 2040, isn't the chip to use if you want to use Bluetooth and then Arduino interjects saying allow me to introduce myself. There is an NRF with a 9XX, but the price was high. Does that ring a bell? Yes, that's that's a sell you sell you learn chip. I think is the is the nine series. And they are expensive. Yeah. I do have an Arduino portenta H7 that's crazy for when I need a lot of horsepower and Billy and Ethernet and a bunch of other things. I suspect I'd probably get to it if I wanted to Raspberry Pi. Like Billy on the Raspberry Pi would be really cool because imagine like we get all this Billy workflow stuff going and then you have your Raspberry Pi sitting next to your TV and then you're on your phone programming from your phone, what's showing up on the TV? Like that would be really cool. And that's the reason that I like I think I would want Billy. Externally with that. All right, just so expensive. Hundred dollars to the H7. Yeah, like if you can buy a Raspberry Pi for thirty five dollars, it's like as long as you're OK plugging it in. Isaiah asks, ever use the blue NRG one by ST. I have not. I haven't. It's only got twenty four K of static RAM. That is not a lot. Circuit Python won't be pleasant to use without like 32 K is a minimum. And if you're running a Billy stack, like twenty four is very, very tiny. Not going to have a great time. Xenia says I'd be done with using RP 2040 with a Billy co-processor. Doctor says Pi Zero W for five dollars gives you a lot of power and Bluetooth and Wi-Fi. I don't really count the Pi zeros because they're they're not actually five dollars. If you ever try to buy more than one, it's like fifteen dollars, which is still great. Like, yeah, Eric says the blue energy is appears to be an old product that's being replaced by the STM 32 WB series. Yeah, we're doing the internet first. Gotta start somewhere. And that that unlocks a lot of products that we already have. Oh, sorry about that. Xenia, now I see it. Thank you for correcting me. Maybe many people were introduced to MCUs because of RP 2040. It's a new world for them. They don't know what else exists. Yeah, I think the pi zero W's are ten dollars. The ones without Wi-Fi are five. OK, let's get into the let's dive into the into what we're doing. So this file here, October twenty nineteen. I started this project when we were doing Bluetooth stuff. And this is one Billy came out. And then in February twenty twenty right before the pandemic, right before the pandemic hit in the US here, at least, we were talking about giving Bluetooth devices to everyone at Picon. So it's about like three thousand people or something in in the like bag that you get at the conference. And we kind of realized like, oh, this is a bad idea. This is a bad idea because at the time when we had first implemented it, we didn't have a way to like make sure that you were the one connecting to your device. And and that's a problem like you to do it properly. You need to make sure that like there is some difficulty kind of swooping in and taking over a device for someone like it's not critical. Like like please don't expect your code to be safe and secure. But at the same time, like we don't want like casually malicious people to be able to disrupt your experience. Right. So like the way what I'm imagining is like you're at a conference actually I was at a conference that had this problem. So the the Open Harbor Summit one year had these ink badges and they had Wi-Fi ESPs on them. And they they had passwords, but it turned out the password was the same for all of them. And so there was a few people that realized this and kind of like trolled a few other people. Like it wasn't super bad, but like it just it needs to be good enough that like there needs to be a bit of a bar to prevent people who are like, I'm going to just mess with somebody else. I also imagine like you're in a classroom full of kids and like you just don't want like the person sitting across a room from you to to kind of swoop in and do it. So what you'll if you try the the new version of the Glider app, what you'll see is that you actually have eight only pairs if you're real close. But I don't know if the device enforces that. I know the device doesn't enforce that. So that's something we're going to have to do as well is that the pairing request will only be accepted if you're like real close if the RSSI is really high. Xenia was introduced with the RP2040. There's a wider world than the RP2040. That's all I'm saying. The RP2040 is great for a lot of things. It's just not not good for. It's not good for connectivity. Wonder why the apps around so Python seem to always be native code and not react native or QV. Well, the the first version of Glider I did using react native, but it's just a matter of like the tools that people know. So like Antonio is a native iOS and Android developer. And then like Trevor is native iOS. It's just a just a matter of what people know. OK, so the the gist was that kind of over the holidays of 2019 2020 like we had this code and then we turned it off. And there's like a little bit of stuff that changed, but not much. So what happened is I went to dust it off and get it enabled and running again. And I found some stuff that was no good. And I'm actually to the point where I. The first thing that you have to do is you have to advertise. You have to say like, hey, I'm here, like connect to me. And the code like I wasn't able to I was looking on my phone using nrf connect and I wasn't able to see the advertisements. So I had just looked at it right before the stream. I found what I think is the issue. So I actually wanted to test that. As the first thing I was going to do. So I have I actually have an Android phone and it's plugged in. I have a pixel. I forget which number of pixel it is. But I thought I'd use this for nrf connect because I think I should be able to get. The screen mirroring it was having problems earlier. It looks like it's OK. So the first thing oh, it's finishing the system update. So let me just wait a little bit. Why it says it's telling me checking for new new voicemails. And it doesn't there's no SIM card in this. OK, USB debugging is on. So let's just see. So that don't get your hopes up. We have not started an Android version of Glider at all. It is something that Antonio can do. Lady it is great search this week or last if lens. It's good to see you look through microcontrollers. You realize just how many are I haven't seen that yet. I spent a lot of time in the microcontroller section of Digikey, so I'd be curious to watch it. Any Android folks know what the incantation is? ADB screen mirroring. I didn't actually get a chance to care to do it wirelessly. Let's see. Let's just see if ADB devices works. It should be plugged in. Yeah, it is. OK. Over Wi-Fi screen record that will not work. Is that right? Do I need to connect to it? ADB show. Let's do. You need to tap on something in the advanced sections about a billion times. It does say that it's already enabled, like the debug stuff is enabled, which I probably did ages ago when I use this last. I think it's let's see what Oculus says. ADB devices while true do screen record time limit. That's weird. I could do it with a camera. USB tethering is on. That's so weird that it has to do with through screen record. Let's just try this. Let's see if there. Oh, I do have the LC. You know, there is NRF Connect for Linux, too. Isn't there nothing? This reminds me. Can I just do it? Does this work? Oh, you know what? I think I might need need the dongle. Yeah, this will be the better way. I just want I want it so you can see if the advertisement shows up. I might have to run in the other room. I need to grab. I'll show you what I'll grab after I grab it. All right, I'll be right back when you go. I know what I need. So here's what I've got. Got my NRF and ESP box. And what I need is this. That's what I'm looking for. It's like the NRF dongle that it can load software on to. So now this I don't know if I want to. Oh, that I don't care. Select device. All right, this looks good. Ha, ha, ha. I spent most of this week in the BLE app. NRF Connect is great. If you're doing any sort of BLE stuff, it's the place to start. All right, so we found our dongle. So let's see. I can't get this. Both places. Can I close this? Yes, I can. So what I've got here is I've got J-Linked. I'm J-Linked to you can't see it. It's not going to be exciting. But I have a feather blue NRF 52A40 on my desk that I'm J-Linked to. And I'm in GDB. So I'm going to reload. And then I'm going to start the scan. Oh, and of course, the scan shows up on the other side of the screen. So here's all the stuff in my house. And I'm going to continue. And maybe we'll see. Nope. Didn't work. Let me see. I'm just going to check with my phone, too. So this is the first step is trying to see if it. No, my phone doesn't find it either. We should see a device that has the name Cirque. C-I-R-C, I think. But it's not working. So we're going to have to debug that. Yippee. Let's see. It should have a name. Let's see where it is. So we're just in code.py. Ah, David says, will this be a leak code work on the ESP32? In the long run, I think that would be neat. In the short term, we're just going to do NRF at the start. Control-A usually jumps to the beginning of the line. Does Fish not have that? It probably does. I just don't know it. I'm actually quite bad with the keyboard shortcuts. I'll try to remember that Control-A to get to the start of the line. If you don't hook up your project to the NRF 52 dev kit you're using as a programmer and you flash the onboard NRF, you'll become endlessly confused. I feel that knowing which thing that you're doing. DCD says, think Emax. I've never gotten my head around Emax. And yeah, Control-A is select all in my book too. OK, so I do have a variable here that says advertising, I think. True. So it did get to the point where it should have turned it on, which is even worse. Great. So here I am in Bluetooth.c. This is the shared Bluetooth file I was showing earlier, but this is the new version of it. So this is what happens if it's the Beely file services off. We just do empty stuff. Control-Aro works. So I've changed it to just have the version and transfer characteristics. I've switched to the new UUID for the file stuff. And I'm doing the Creator ID. One thing I was a little concerned about is that this is like 31 bytes, which is kind of all that you're allowed to. Let me just comment. Let me make it shorter. We can comment this bit out. Let's just see if that works. This is just TX power. We don't have to have that. And then here you can see, here's where I say advertising true. And there's this Beely adapter start advertising. Let's take a look at whether this returns a status. Generally, if it's a private API like that, it will. Yeah, so it returns a number. So let's capture that number. So this is me trying to debug. So I think what we should do is in, I have too many tabs open and the window is tiny. So in here, status equals if status not equal NRF, what is the OK thing? Breakpoint. So if we don't successfully start advertising for some reason, return. I think it's just NRF OK. Busy. NRF success. That's what we want. All right, so if the status is not success, then we'll breakpoint. So let's load this new code. Again, so what we're trying to do is we're not even to the Beely part yet. What we're trying to do is just advertise so that we can initiate the connection. Did I miss the talk about what is a raw int? No? I saw that go by, but I didn't really crack the context, one that isn't cooked. All right, let's try it. But first, let's get this in the background. Clear. Start. Oh, I got really excited for a second there. Well, it didn't do the breakpoint, so it should have worked, but it didn't show up. Um, the next thing I'm thinking of is that it's possible to, I mean, it's possible the name is wrong, but the service it would have would be F-E-B-B feed. Nothing. Nada. OK, so the next thing I'm going to think about is maybe it's being turned off too quickly. I think it shouldn't say raw int, it should just say int. Hi, Dean. So status must have been OK. Advertising true. Let's just see if we're disabling it again. So this should start it. Trying to think of the techniques I do. Let's see if we get USB. Let me turn USB on, because if we could get print out, but that would really help. Oh, this is probably not what I want. I don't think USB is working. Yeah, see, that's just the Nordic. It's not. Oh, that's bad. OK, this is good. Let's talk about this. So if you're ever in GDB land, what you want to do is reset into safe mode. It's a great place to set a breakpoint. So if you do reset, I miss that. So here's what happens. So now I've braked and that's what I was, this is what I was doing yesterday, is if you crash, you get a hard fault handler. And then the hard fault handler calls this reset into safe mode. But other things call reset into safe mode as well. In this case, this is how the code rotted. So I worked on it at the end of 2019. And we haven't used it since over all of 2020. But some of this stuff has changed. And what's changed is that we've added places that do allocations that they didn't previously do allocations, which is a pain, actually. So here what we're seeing is that if we start from the top. So here's our main loop. And our main loop is calling supervisor start Bluetooth, which is something that's been in there but just didn't do anything. Now we're saying, OK, we want to turn Bluetooth on. And we're going to call the background stuff that starts the advertising. The reason the advertising stuff is in the background is that if you start your device up, and it's going to advertise for a while, but it's not going to advertise forever. And we actually do want it to advertise forever, but maybe with different advertising policies. Because if you have a BLE-only circuit Python device, and it's been running for two days, you're going to want to be able to connect to it to fix it or do something else with it, even if it's been running for two days. So what I think Apple recommends is that on power up, you advertise really frequently. And then from then on, you advertise very once in a while just so that people can see it. So that's why I have this start advertising happening from this background, the background task thing. So we call Supervisors Start Advertising, and that calls Actual Start Advertising, which this function is now calling this Add Event Handler. And it's doing an allocation, which it shouldn't need to do. So let's take a look at that. What we'll do is we'll replace. So what it's allocating here is it's allocating a struct to keep track of things. And what we can do instead is, I was going to say we can allocate it with the object, but that's actually not a good idea. It's probably OK. I'm thinking about the garbage collector. So if you have, well, it's an adapter. The adapter is not going anywhere, so it should be fine. So let's take a look at this. Adapters start advertising, and we're going to have to have it statically allocate a handler for it. What's backslash 0, 16, t circuit pi? What is that from? What's the context of that work? It's not going to be a static global variable. It's not going to be that bad. So what we can do is let's look. So here, and in Start Advertising, oh, number four in the backtrace, it's the scan response. So it's printing the scan response as if it were ASCII. So the backslash 0 is octal. So this would be the ADT. Should we talk about BLE advertising? I haven't pulled up, I think. And then the backslash tab is actually the length of, no, this is the length, this is the ADT, and then this is the contents. So if that wasn't a good explanation, which it wasn't. So if you want to see Bluetooth specs, you can go on the bluetooth.com. There's two that are really handy. There's this core specification supplement, and then there's the regular one. I think I found by just searching Bluetooth. So there's this core specification 5.2. So that's what I have open here. So these are giant documents. But here's the core spec, and I think it's in version three, generic access profile. Advertising scanner, yeah, this is what I wanted to show. Yeah, so here, this is the structure of an advertisement. So there's a total data, it's an AD structure, and then there's a structure one, structure two, until you're filled. An octet is also a byte, it's like eight bits. So first you have the length, so that's what the 16 in octal is. I don't know what it is in decimal. And then what you have is you have your data after that, and it's usually the AD type. So that's what ADT is, the advertising type, and then the advertising data. And then it says these AD type identifier values are in the assigned numbers. So if you go back to the website and you go under specifications and then assigned to numbers, they're here. So there is UID numbers, there's appearance value numbers, and then there's, I think that they're the generic access profile abbreviated gap. Randall says 8 plus 16 is 14, for the octal. So here's, these are the EIR data types, advertising data types, AD type, and out of band data type definitions. So there's flags, there's incomplete list of 16-bit service class UUIDs. So if we go back to my code, we can see how this is structured. So this is just the byte array, we have just like a static advertisement that we're doing. So the two is the length, right? And then the one is for flags, and then six is the flags. Dean says, do you use a Raspberry Pi and if you do, what is the best OS? I rarely do, but I think Raspbian is kind of the place to start. OK, so that's 2-1, and then here we have a length of 3, and it's 2, and then it's BBFE. So that's this incomplete service list. The reason there's a difference between incomplete and complete is like it might ask later, like it can do a scan response if it wants to get more data. So there's also eight shortened local name, and then there's FF here. Yeah, there's manufacturer specific data here, which is FF. So if we look here, again, we'll see, oh, and it reformatted Adomni. I had it all nicely indented. So here's a length and then manufacturer data, and then we actually pack. So this is the Adafruit manufacturer ID, and then we actually use the same format that the advertisement does within our data for the manufacturer data. So we have a length of 10 here, and then we have this ID 4. We use two bytes for IDs there, and so this is, so it's 10 total. So we're 2 for the ID, and then 1, 2, 3, 4, 5, 6, 7, 8 for the creation ID. Mark says, I see what you're doing here. Is that whole thing sent as one data packet, or are they chopped up somewhere down the line? These are sent all as one. OK, the reason I asked was because it was like you knew about two. I would start with Raspbian if you're starting, but if you're not finding what you want with Raspbian, then trying new bunch would be fine. But yeah, on a proper Linux computer, I use Arch. Yeah, so these are not broken up. There's more information about the flags in the supplement. So this is the supplement to the core, and you can see data type definitions for like manufacturer data, two or more octets. The first two octets contain the company identifier code. Bidene. And then yeah, we have one of those because we are, Adafruit is part of the Bluetooth sig. So as long as you satisfy the message format, you can pack your packets. Yeah, I mean, you're limited to like, it's like 31 bytes or something, although Bluetooth 5 has extended advertising as well, but like Bluetooth, Beely 4 has, it's kind of, I think it's 31 bytes, where it's like you have an initial just broadcast, but then the thing that's doing the scanning can say like, hey, like, can you, yeah, David says line 82 exactly maps to that 16 circuit pi. Oops. Yeah, so what happens is this advertisement goes out and then the thing that scanning actually has the option to initiate a scan response. So it says like, hey, I want to scan you as well, which is a chance to get a second packet. And that's what this second packet is doing. This second packet is giving the full name of the device and these last four I actually need to fill out with the like unique MAC address of it. But yeah, again, it's just length and then the nine for a complete name and then circuit pi encoded in ASCII. But the factory says, as prototypers, do we have to be careful about what we push over Beely? If prototype evolves to production, different rules for advertisement. So do you have to be careful about what you push over Beely? So all of you should think a little bit about encryption. Generally like what we do at Aida Fruit, everything's open. So it's not too bad. Like we're not concerned about security, but remember that like when you're advertising, anyone can listen like advertisements themselves are not encrypted. So anybody who's happened to be listening could record that data. And I think that's commonly done for like, there are systems for keeping track of like when people are in stores and they use Beely advertising to kind of keep track of how many people are there and try to keep track of like who's unique as well. If prototype evolves to production, different rules for advertisement. No, Beely I think is caught on a lot because they're not super strict about like whether you pass or not. But again, you should do your diligence on whether you're doing everything right. The other thing to think about is like in terms of when you're advertising, like how often you're advertising has a big impact on, it has a big impact on battery life. So that's when you're going from prototyping to production is probably there is going to be some work as well of like making sure that you're fitting your advertising or fitting your power requirements as well. Mark says, after you set up a connection and you're in an encrypted channel, are you allowed to send a Beely ADT packet to say that actually I can do these things? I can also do these things. So you don't need at that point, once you have a connection, you no longer need the advertising stuff anymore. So advertising is all part of GAP. So there's GAP and GAP. And GAP is like is connection initiation and advertising and scanning, whereas GAP is all about like what you do once you're connected and once you're connected, like it can, there's a whole process, a whole GAP process for discovering all the services. So even if you didn't advertise something, you could still discover services. And then you can also discover like a different name potentially as well. So like there's a whole GAP side as well. So you don't need advertising at that point. Once you're connected, you don't need advertising. But you can say like, you could just say like, I'm gonna advertise and here's an incomplete list. The other thing that's kind of interesting that I should point out in terms of what you can advertise is, sorry. I haven't allergies this week. One of the interesting things that you can advertise as well is there's actually indoor positioning explicitly. Service data is the other way to have data in there. Where is it? Oh, here we go. So here's a solicit. So what you can do is you can advertise not only the devices, not only the services that you provide, but you can also advertise saying like, hey, I'd really like the time. So like your iPhone can say like, oh, here's the time. So what you can do is you can actually broadcast out like, hey, I'd like the time service, please, the current time service. And then once you connect it, then you can like get the time from the other device. Mark says, okay, this is sort of like how Apple's devices lie such fit about their Bealee profile until you actually connect to them so you can't be tracked with your Bealee device. Yeah, so in terms of tracking and the COVID stuff is really interesting. Good night, Dave. Thanks for hanging out. So the COVID tracking stuff is really interesting because in the air tags are kind of in this camp too, is you want enough different differences in your tracking so that people can't kind of like assume that they're, assume that it's the same device over time. And I was starting to look at this, so I stepped it out and I can't get too into the weeds now, but once we, once I have the Bealee service, file transfer service working, I do, I will need to go back and think about when we advertise, how we advertise and how often. So basically it's gonna, I think I've talked about this before but we can talk about it again. Like there's gonna be two cases. There's going to be, I'm a circuit python device but I have USB so I might just be using it with USB so let's not kind of be aggressive about doing Bealee. And then there's the, I'm only a Bealee device so what do I do there? And so when these both start up, the very first time you have them, they're not bonded. So bonding is the process of like, once you've connected to something, you exchange encryption things and you have knowledge about the things that you've seen before. So if you start up and you're not bonded, meaning you've never connected to anything else, there's two options that you wanna do. If you're USB I think you just don't wanna advertise at all. You just wanna say like, all right, like I'm gonna assume you're USB, I'm not gonna be aggressive about advertising and then there will be ways to like trigger it to advertise. So I wanna do like a startup window like safe mode. So like after safe mode, it will be blue for a second and then if you click it there, what it'll do is it'll start up and it will advertise. But on the Bealee side, if you started up, you've never connected to anything, you should publicly, you should advertise publicly that like you're a file transfer service device. And then you'll connect, you'll pair and bond and then if you started up a second time anew, you don't start up public, what you do is you start up private, which is a different, you have a different address but that address and that address changes over time. But when you bonded the first time, you exchanged information so that the other device would be able to say like, oh, I actually know that that random number is actually like this device I talked to before. So yeah, that way that like the second time you connect and you're broadcasting like, hey, connect to me, hey, connect to me, it can actually change and like break up the idea of like tracking you with it. So yeah, I'm gonna think about that. I stubbed it out but and then the other thing in terms of timing is like right after you start up, you wanna advertise a lot, but then if like somebody hasn't, if somebody hasn't, hasn't connected in that time window, then you kind of back off and take a longer time. Gareth says, how to clear bonding information from a device? So in Beely IO, there's an erase bonding function call that you can call that will delete all of the bonding information. Mark says, I appreciate the answers. I'm sorry I took a little off topic. No, this is fine. This is deep dive on Beely. That's what we're here for. It's making the Beely process way more clear. Yeah, it took me a long time to wrap my head around it so I'm happy to pass that on. I think I should maybe pick up an Ubertooth one and jump into the weeds. I would recommend just like the Nordic tools are really good. I haven't actually used an Ubertooth one myself so like on your phone, on your phone like you can just do the NRF Connect app and that's really great. And then the dongle, the NRF dongle here, it's like an NRF 52840 dongle there like 20 bucks or something and you can plug them in and now you have like your desktop doing it as well. Oh, Gareth says, am I in your usage scenario? So what I think, so if you're bonded but you want to rebond, what you would do is you would have that window at startup when you clicked it and you'd be public again. And that would be true in both cases, like in the case that it's a USB or not USB device. So you plug your device in and go yellow for a second for safe mode and then go blue for a minute in safe mode. Yeah, blue for a second for bonding mode or whatever, like pairing mode. I forget what they call it. The doc actually says what the general discovery, old discovery, oh, discoverable, that's what it is. Oh, I forget where I saw it. These docs are giant. Actually, this one's not. This one is 3,256 pages. Alvaro says, can you use advertisements to simulate something like ESP Now Mesh? I would take a look at what BLE Mesh is doing. But yeah, generally, yes. And I think one of the good things and probably still underrated things that came out of me looking at BLE in 2019 was the BLE broadcast net that I did. It's not mesh, so messages don't get retransmitted by nodes, but yeah, that's there. I should say there was an old PR open that I actually finished, which is adding transmit power to advertisements as well. So you can boost the power just to smidge more than what it is now, if you are doing some sort of mesh sort of thing too. Beata says, I'm getting a 52,840 here soon. Awesome. Yeah, I like that. Ah, Ron says, can I watch this offline? BLE understanding is critical for me on the NRF 52. You can totally watch it on YouTube as well. I see you're on LinkedIn. YouTube.com slash Adafruit, and the recording will be under there. If you go to videos, you'll see it, or you can go to playlists, created playlists, and then deep dive with Scott, and you'll see all of the older stuff too. But this is the first, one of the first times I've gotten into deep BLE stuff on the deep dive, I think. Cause I did Wifi, I did ESP32, and then we did RP2040 and stuff. But I'm happy to answer questions here, and I would recommend joining the Discord server as well, which is the URL, adafru.it slash discord. Okay. All right, we gave up on Android mirroring for now. So we still don't know why it didn't work. And for some reason, USB is not working as well. Oh, wait, we do know why it didn't work. We haven't fixed this. Love the factory says, can we look forward to BLE stuff to and from Circuit Python and Windows, or just mobile phones? I don't think that Adafruit is going to sponsor that. I wouldn't be surprised if we did web Bluetooth as a way, and that would work on Windows and non-Windows. But a Windows native thing, I think somebody else would have to do. But I think Adafruit development will be focused on mobile to start, because those are the people that don't have access to our stuff now. But yeah, I think it's a public protocol. It's well, I hope well documented. Love the factory says, Circuit Python and Circuit Python? Yes, already does that. So if you look in the BLE file transfer repo now, they're in examples, there's, I'll just pull it up, whoop, in examples, in here. So here, there's two examples. There's this simple test. So this is the client code. And then there's also the sub server code. So you can do this already between Circuit Python devices. Yeah, and if anybody wants to help take time codes, synced to YouTube, there's a doc there that David DCD has been helping out, but they have to leave a little early. So if anybody wants to just drop in there, I suspect we'll just talk BLE the rest of the time, but if folks wanna help out with that, that would be awesome. And David links to their code to listen for COVID app advertisements. Garry says, will you put in an RFC for it? Is there an official body I should send it to? I would love comments on it, but I think at this point it's kind of like good enough. There's a version number, so we can always, we can always re-app the version number later and tweak it. Like TAC had some ideas about like recursive delete and move and copy sorts of stuff. So like maybe that will become in a V2, but I really wanna get V1 out the door. Like as we're seeing here, like this code doesn't work anymore because we didn't have it active in using it actively. Like this is, I was thinking about this like, this is bit rot and it's kind of the term for it. It's like code that used to work that doesn't work anymore, but the code's still the same. It's just like the code around it changed, causing it to stop. And so it's really important to not get, like the focus on this BLE work needs getting it to be getting it active and actively used so that it doesn't regress, it doesn't rot. So like we'll do potentially V2 if we think that there is stuff worthwhile, but like, how do I know what the correct time for the time codes is? I think you just see it on YouTube. Like, I think you, does YouTube tell you a time? Sorry, I just go based on YouTube because that's the only place that the notes end up. And if there are any that you're uncertain about, I can always check. But yeah, they're not gonna be relative to real time. They're gonna be relative to when the video started. Yeah, we just passed one and a half hours. If you hover at the beginning of the time bar, it shows the time. That's what doctor says. Thank you. Thank you, doctor. All right. So yeah, we already have circuit Python to circuit Python example code. So like what we should be able to do is if I get the real server running, which would replace this file, I should be able to run circuit pot, this simple test, should be able to run this simple test code that's like write a file, read it back, make a directory, list the directory. Like I should be able to run this against a real device as well, which will be really handy for testing. It's all good, Gareth. We'll get, it's a good thing. Yeah, so time codes, if you have like, oh, we're changing subjects sorts of stuff, that those can go in the note stock and they end up in the YouTube description, which allows you to see it, like it chunks the bar at the bottom after the fact. It allows you to skip around, which is really nice. Okay, so we had this problem that the advertising code is trying to do an allocation for the handler. So what we have is that this is specific for the NRAF. So this is part of the problem. Like in terms of like, what are we gonna support with this? Is like, there's a, there's some gonna be some like bad abstractions or lack of abstractions we might have to make better to support other BLE later on. Like I just added that thing that like checked an NRAF return code, for example. When I'm in supervisor code, theoretically supervisors shouldn't know about what BLE implementation is dealing with. So what we need to do is we need to fix just something in the NRAF stuff. So it has this BLE DRV, which is, I think, BLE driver, add event handler. So if we look in NRAF Bluetooth, there's this BLE DRV.C. And it handles this, oh, add this event handler entry. And it does some like, it's a linked list. So it connects it up. But you can also, this is handler entry. So this version allows you to provide it. So it doesn't do an allocation. Whereas if you don't provide it, it does this M new LL, which is a new allocation of a long-lived object, which is a pain. And that's, so we're getting here and this is what we're failing. This is the allocation that we're failing to do. And what this is doing is there's actually like an interrupt that we get in for every event from the SOP device. And we do some flash stuff, but then we also do like a loop over the linked list and call each function in it. It's a way for us to kind of like give BLE events out to different things that care about different events. So in this case, this advertising stuff, we'll take a look at it here. So it's in adapter. Start advertising. And it, okay. So this here doesn't have the underscore. So this is the version that you, when you call BLEIO, start at adapter, start advertising, this is what gets called. But then it calls out to this underscore version, which is like the internal API that should be allocation free, but it's not. So if we go, and we take a look at that, we can see it's setting up some stuff. And then it's doing this add event handler. And this is what's doing the allocation. And then it's doing it on this advertising on BLE event. So this is what's getting called. And it's just keeping track of when the advertising is finished so that we can say that the advertising's done. So what we wanna do is we wanna say, we wanna do the entry version. And let's actually, you know, I think we do need a second one. But what we can do is we can put it on the self object. Mark says, why is allocation free important cost too much CPU time and desyncs the protocol? No. So the problem is that these allocations are allocations onto the Python heap. And we're actually running all this code. We're starting up BLE before Python is going. And so we need a way, like we can't allocate because the heap for Python is not there yet. And we also need to make sure that we also may want these objects to live across multiple Python heaps, for example. So the easiest way to do it is like, we actually, so every object is actually a struct, right? So this is the struct for the adapter. And then if we look, where is it? There's just like one adapter that's like statically allocated that always exists. I don't know where it is. I think it might actually be in shared bindings. Anyway, so what we can do here is we can say, I already did this for one. I already had to do this once. I think this is the connection. So I wonder if we're gonna need it for other stuff too. So I'm just gonna say connection handler entry and shared handler entry, because we should just see. So here on BLE event. So when we get a new connection, we actually create connection objects, right? So in set enabled, this is the one I fixed yesterday. So that's the connection handler entry. So that is this adapter on BLE event function, which is the one that's keeping track of connected and disconnected. And I don't know why advertising set terminated is there like this theoretically should be handled by the other one. Where's the, right? So here's scan. So scan is going to do an allocation, but we're probably okay because we know we're not gonna scan and then connect. Like we're not gonna be doing connect either. So I'm gonna cheat it. So there's this BLE set terminated. And then there's the stop advertising call, which should, you would think, set it to null. I don't know why that's there. Should we see if we break anything? It should be covered. All right, we're just gonna delete that. But then what we need to do is in start advertising handler, let's do, let's just call it advertising event. All right, let's see how far we get. Reboot debug to rebuild and tell us that we named it wrong. Save the file? No, I didn't. Gotta save the file. And it's still going to work. Needs a, gotta give it a pointer to it. Doctor says, I wonder how many weeks I have to join before I start understanding most of what the heck is going on. Well, we're definitely, like there's a reason it's called deep dive. Like I've been programming for like 20 years and I went to school for it and I worked in industry since 2009. I've been programming professionally for 12 years. It takes a long time. And I think you're, if you're just hanging out and not getting most of it, you're actually getting more than you think. And the next time you see it, you'll start from where you left off. So it's just totally okay not to understand it all. Totally okay. And if you have questions, I'm happy to answer them. But like, this is complex stuff, not simple. So we're gonna continue and we're gonna see what happens. And it looks like it's didn't crash. So let's do a scan if we're still going. My TV showed up. Or no, that's not, do I have a Samsung? No, I have an LG. That's not my TV. Somebody else's TV is saying that it's there. NeuroDoc says the deep and deep dive stance were deep. Doctors says I've been doing programming in general over the last 20 plus years, just never got to the professional level and haven't done any Python before a couple of weeks ago. Well, Python's awesome. And BLE is complicated too if you haven't done BLE. So I know Jupyter notebook now handles collab editing. Well, dang it. It didn't show up. Let's see where we are. Backtrace. Well, we didn't crash. So let's reset and are we still? Oh, we're on data still. So did our USB show up? Why isn't USB working? That's a bummer. That can help a lot if USB works. I wonder if I just, I wonder if I just, let's not use JLINK. Let's just try it. I'm re-plugging it in. Ah, I heard it on my headphones. All right, screen. I would like to get this going. That would be nice. Oh, it did respond. I don't even know what code's on here. It shouldn't matter, right? Like I'm working in the core. I have a NeoPixel MPY on it. It's some NeoPixel stuff. Okay, well, that's good news. So what I wanna do now is I'm gonna eject. And I wanna get, there's, oh, yeah, the dead beef. Evander says, is Sublime an intentional choice or rather a habit? I went from Kate to Sea Lion and I think it's helped a bit, but I don't have long experience with it. Have you taken a look at more professional IDEs? I used Kate back in the day and I definitely tend to like that style of like primarily just a text editor with syntax highlighting. I generally don't like more professional IDEs. I find them slow and annoying. And VS Code is the one I tried most recently and I disliked how noisy it was in the sense of it. It was always popping stuff up. It really bothered me. And then like what you get is like all this background preprocessing of stuff which is supposed to help with autocomplete, but it's like, it also just spins everything up. And I just, it's, I like my tools to work across languages and stuff. And so I've never found, I've never worked so deep into a single language that it's really helped me. So I think there's a place for IDEs but generally I just not found it. Yeah, the object object stuff is a Discord bug. Corky says, I watch your deep dyes to feed my unconscious. Yeah, I totally get that. I love watching stuff to let my, like not to let my brain just like simmer on it in the background. I think that's really cool. But yeah, I'm really happy with Sublime Text. It's very fast. So if you're not super into Sea Lion, you should give Sublime Text. It's gonna feel like Kate, I think largely, but I've been pretty happy with Sublime Text. I was on Mac for a while, which doesn't have Kate, I don't think. So, mm, mm-hmm. The Discord thing hasn't worked for weeks now. I was thinking maybe I should come up with a different way to do it. But that's for another day. I was gonna turn on the BLE debugging. So let's look at, let's figure out what the circuit pi verbose BLE is what I want. And let's leave this. And yeah, we're a dead beef now. I thought it was, it's in H files. I'm just gonna put it in MP config port H. Let's just put it next to the BLE stuff. I don't know, I'll rip it out later. Let's turn on verbose BLE. Let's see, like this will give us some debugging info. So one of the challenges with debugging BLE is that it's timing sensitive. And so using a debugger to figure out, all I got here is like not great because that can cause, that can cause basically all the BLE stuff going forwards to not work. And so I actually find printf debugging to generally be better because it doesn't, it doesn't stop things. It just tells me what's going on. So, okay, we made that. Let's make clean. And we don't need, we don't actually need to do a debug build anymore if we're not using the debugger. Oh, it's redefined. Oh, okay. We'll change it there instead. I certify MPK pig verbose verbose. Like we'll be able to see these in the diffs. Source, I don't know why that's in my history. I should figure out how to delete stuff from my history. That never worked. David says, oh, funny. It looks so much like Objective C. I use VS Code. It's 2020's response to Clippy. Mark says, I love Sublime Text. They just upgraded to four. It's so fast compared to other editors why being so easy to type around in their default keyboard shortcuts also just work. I think it's actually JavaScript under the hood for what they are using their Discord app. I would actually love to fix that if somebody could point me to where the code was. Fumiguy says, I've gone to opening a browser window with the Discord web app and feeding that into OBS instead of that feed overlay specific thing. Yeah, I could do that. NWK says, Spider is a great ID for Python, specifically if you're using ipython, scipy, numpy or you want to set breakpoints for debugging. So that's a good point. I was, I never appreciated Kanda until I started doing some Panda stuff for the fiber deserts things. Like I didn't understand that Kanda built all the C based modules based on the same version so you don't have conflicts. I think that's really neat. Probe effect is when a debugger causes different behavior than when it wasn't there. Yeah. Okay, we made it and now this is where when people are like, oh, I've got to have fancy things. Fancy debugger people will be like, what are you doing? I'm reset, I'm double tapping the feather and I'm gonna drag it over using U of two. I'm always amazed that programmers are like super concerned about how fast they can input text into the thing. It's like, that has never been my bottleneck. Like I've made it this far and I do printf debugging. I'm not the fastest keyboardist and I use a mouse and stuff like, hi, Commis. Hope I said that right. Commis? All right, so I just dragged it over. I can actually hear like the USB. Oh, I did screen. That's not right. TO is the best. So we turned on verbose be lead, but I don't know what it should print. Fetty two says, have you ever tried a weird keyboard layout like the Vorac? I'd spent two hours with the Vorac and then I realized that it's not a good idea. I switched actually to Colmack a couple of years ago now and I highly recommend it. Colmack is much more modern. It was designed for people that are coming from QWERTY and Mac has it in the dropdown, so you could just select it. It's like pretty easy to switch. Okay, so I just wanna hit reset and see if we can't capture any sort of beally prints. I have a feeling we might just be turning it off. That might be our problem. So no beally prints by the time USB. So we're actually starting, I think we're starting it up early. So I'm gonna actually just, I'm gonna cheat and see if my problem is that we're turning it off. And the way I'm gonna do that is, well, first I wanna just make sure there's a print here. So we should be seeing these beally events. So let me just go into adapter and there's this set enable and there's this soft device disable. I just want it to like, don't turn it off. Don't turn it off if we're not going to. So I just wanna try that. And I think we're about, yeah, we're about out of time. Any final questions, please get those in the chat and I'll answer them. But Dr. you're following for it. Typing speed really doesn't matter that much. Considering the number of machines that use the fact that I have to share systems with folks at times and touch other folks to system, I didn't wanna go from a hundred words for an inquiry to lower our speed on both. So when I type query, I'd stare at my hands now. But let's drag it over. Mark says I'm a printf debugger and console login JavaScript. It's also like the easiest tool for the job in every language comes with their own at no additional costs. Yes, a hundred percent. David says I switched to Dvorak in the nineties. I thought about switching to Comac now and then, but I found it not compelling enough or Dvorak. I finally, when I did that switch, I finally stopped looking at my hands. That's the other thing. Like I chat with my parents every week and they actually noticed that I no longer had to look at my hands to type. Like I do occasionally and I definitely do if I'm doing query, but like, we're still not getting any error messages, which is weird. Let's just try the skin one more time. Let me clear. See my headphones. I mean, it's weird that it's not printing anything. So many spammers. Pre-baked beats said I get a headache just thinking about switching from QWERTY. So the nice thing about Comac is there's only one letter that's on the different hand. Is there a Beely version of a TV be gone? I don't know. Doctor says, wait, did you look at your hands before you switched? Yes, kind of. Not like a lot, but like I would occasionally. Yeah, sorry, I like, if you don't want to switch, don't switch, but like I found once I switched to Comac, there was a lot more words I could type with homero. And I think that's really cool. So it definitely took me like a few months to switch, but like I was, I've struggled with my hands being unhappy and my right hand this week has been not super happy with me because I've been at the computer a lot. So I don't know. Like you definitely will take a hit, but I think it feels pretty good when you, like it clicked for me and I was like, okay, this I get why this is actually better. Like there's so much more you can type with the homero. So, all right, let me just read back last bit. How do you use a laptop? They're all going to be query, they're labeled query. You don't have to read the labels. If I have to type something when I'm like at the place typing something I have to look at my hands to do it. That's fine. Yeah, Gordy says I never learned to touch type query. I finally decided to learn to touch type and decided Dvorak would be the best. Now, every time I have to use anybody else's computer it's back to hunt and pack. Yep, that's how I am too. The shipper says what helped me with touch typing was a split ortho keyboard. Yeah, I have mostly blank. My keyboard is actually quite funny. I have like some blank keys and I have some, okay, don't mind the cat hair. I actually have like some blank keys, some labeled keys. I left the labels on the keys that are in the same spot and I put blanks where it's different. All right, let's get out of here. That's a bummer I didn't get it working. That's life, that's what Monday is for. Maybe I'll think of another thing to try. It's weird that it's not printing out any error messages for it. That makes me suspicious. So, David says I definitely agree that switching from QWERTY is recommended generally speaking. If I was switching now I'd probably use Colmack but I'm happy with Dvorak too. Yeah, see Dvorak was created in like the 1800s and it was created as a system for people who have never learned to type whereas Colmack was created in the 2000s and Colmack was designed for people coming from QWERTY. So like they minimize switching stuff. So I'm happy with it. I'd recommend Colmack to folks that wanna do it. Wanna give it a try. Yeah, maybe it's just broken. All right, thank you everyone. It's been a pleasure, let me do the wrap up. This has been another deep dive. This week's back in his bed because I froze him out with the window open and the sun has gone away. I hope that Beely advertising stuff was interesting. I think advertising is actually quite powerful and people are kind of like, even Linux is kind of like tuned to just like, oh, only is useful for discovering things that you wanna do more advanced stuff in but advertising itself is actually quite powerful I think. So that's the first step to getting native Beely workflow in Circuit Python hopefully, you know, I was down a little bit on Tuesday and Tuesdays are usually one focused day. So hopefully next week, this time next week I'll have a lot more to report and maybe we're gonna be implementing some of the protocol which would be really cool, that would be really neat. If you wanna support me for Adafruit by going to Adafruit.com purchasing something there. If you don't have any NRF 52,840 boards I would recommend picking one up. The Circuit Playground Bluefruit is gonna be kind of the flagship of this stuff. I think it'd be really cool. So if you don't have any of those and you wanna support us I'd suggest that. If you wanna chat with me and a bunch of others check the Adafruit Discord server by going to the URL adafru.it slash discord. If you wanna watch the site of the fact there'll be notes in the description. Thank you, Mohamed. Thank you Minnesota Mentat. Thank you Gordy, Dishapu, Mark, and everyone. The NRF 51 is too old and not enough RAM so I would not recommend that. And yeah, next week's on Friday I think. NRF 52,811, that's probably, the A40 is great because it's got a lot of RAM. Make sure that you have enough RAM. Doctor says, how did you get the name Tan Newt? I think in like 1999 I randomly generated it. I was, the name I had previously I wanted to be, I can't wait, which I still kind of wish I did but I think the problem was is like somebody on Twitter already had it. So I wanted something that was unique and I thought the idea of a newt tanning was a little weird. So it was like randomly generated by something and it was unique and I kind of don't conflict with anybody else. So yeah, a tan, space newt, I got rid of the underscore pretty quickly. I think that was like 1999 or something. Anyway, that's it. I'll pet the cat and we'll get out of here. And thank you all. We'll talk to you on the discords and see you next week. Where's my cat cam? Here. Spook. You asleep? No. Did I wake you up? No, we got to end this stream by petting you. Your nails go to the closing window. All right, have a good one everyone.