XBPS-INSTALL: glob install

I was looking for a way to install all noto fonts on Void. Suppose you want to install all packages matching the pattern “*noto*” then you could run something like.

sudo xbps-install $(xbps-query -R -s noto | awk '/noto/ { print $2 }' | xargs -n1 xbps-uhelper getpkgname)

xargs takes the list of packages in newline format and unrolls it into a long line to be passed as parameter to xbps-install.

Posted in Uncategorized | Leave a comment

Marlin: Plot of Thermistor Curves

I made a handy plot of Marlin thermistor curves to help visualize the difference between different types. If there is any interest, send me a line and I will provide you with the code to generate additional curves.

Additionally, I worked out how to compute the curve of an idealized B 3950 thermistor. Mosaic Industries works out the math in more details, and I have summarized it here.

The temperature in function of resistance.
//
// assumes beta 3950
//
celsius_float_t ideal_thermistor_temperature(auto resistance)
{
	float beta = 3950, Rinf = 0.176323;
	float T = beta / log(resistance / Rinf) - 273.15;
	return T;
}

celsius_float_t ideal_thermistor_temperature_from_raw(auto raw)
{
	float resistance = -4700 * (raw) / (raw - 1024);
	return ideal_thermistor_temperature(resistance);
}

Plotting this idealized equation results in a neat curve that follows very closely the value tables from Marlin (here for B=3950 this corresponds to thermistor type 11).

Posted in Uncategorized | Leave a comment

Delta MK1 Build: Plan for the Base

Posted in Uncategorized | Leave a comment

STM32 “Blue Pill”: Programming the Bootloader with an Arduino

Commonly refed to as the “blue pill”, this development board has great capabilities. The board comes with an empty flash memory, and so it is necessary to load in programs to do anything useful with this device. Thankfully, there is an easy way to do this using a serial port, which an Arduino can provide on its RX/TX pins. There is one caveat, the Arduino’s microcontroller interferes with the serial communication. Connect the pin RST to GND and that should do the trick.

Some Gremlins!

There’s a problem with Arduino Nano boards containing a CH340 chip. If you encounter problems with serial communication, read on. The RX/TX pins on the microcontroller and connected to LED’s that draw away too much of the signal to make it usable. The solution I came up with is to remove the resistors next to the RX and TX LED’s. These indicators won’t light up anymore, a small price to pay for working serial port.

Experimental Setup

Experimental stm32f103 programming setup on a breadboard

Now, in order to boot the programming module on the STM32, set the boot mode to 10, in other words, the jumpers need to be moved around: BOOT0 on, BOOT1 off. On the computer side, run the flash process.

stm32loader -p /dev/ttyUSB0 -e -w FILEPATH-HERE

The output should look a bit like the following.

All that’s left to do is reset the jumpers back to 00 position and your program will run.

Posted in Uncategorized | Leave a comment

(na├»ve) Factorial Function in Cairo

Here is what I came up with.


# Use the output builtin.
%builtins output

# Import the serialize_word() function.
from starkware.cairo.common.serialize import serialize_word

# Naive factorial.

func factorial(n) -> (result):
    if n == 1:
        return (n)
    end
    let (a) = factorial(n-1)
    return (n*a)
end


func main{output_ptr: felt*}():
    let (y) = factorial(10)
    serialize_word(y)
    return ()
end
Posted in Uncategorized | Leave a comment