Crashing when trying to call functions in MCP - minecraft

I am trying to create a client using ModCoderPack for 1.8.8 but when I try to call any function that isnt in the same class such as mc.displayGuiScreen, the game crashes. I have code that waits for keypresses
public void onKeyPressed(GameSettings gs) {
if(gs.jbClientToggleMenu.isKeyDown()) {
this.mc.displayGuiScreen(new ModManager());
}
}
That function is called in Minecraft.java
else
{
jbclient.onKeyPressed(this.gameSettings); // <-=
if (k == 1)
{
this.displayInGameMenu();
}
Here is the entire code for the Client class
Code:
public class Client {
private final Minecraft mc = Minecraft.getMinecraft();
private GameSettings gameSettings = new GameSettings();
public static String clientName = "jbClient";
public static String clientVersion = "0.01";
public static final ModManager modManager = new ModManager();
public static final Logger logger = LogManager.getLogger();
public void onKeyPressed(GameSettings gs) {
if(gs.jbClientToggleMenu.isKeyDown()) {
this.mc.displayGuiScreen(new ModManager());
}
}
}
Crash log
---- Minecraft Crash Report ----
// Hi. I'm Minecraft, and I'm a crashaholic.
Time: 6/18/20 5:53 PM
Description: Unexpected error
java.lang.NullPointerException: Unexpected error
at jordanbaron.jbclient.Client.onKeyPressed(Client.java:23)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1950)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1123)
at net.minecraft.client.Minecraft.run(Minecraft.java:429)
at net.minecraft.client.main.Main.main(Main.java:113)
at Start.main(Start.java:11)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at jordanbaron.jbclient.Client.onKeyPressed(Client.java:23)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Player824'/288, l='MpServer', x=87.13, y=81.00, z=-381.85]]
Chunk stats: MultiplayerChunkCache: 583, 583
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: -52.00,64.00,132.00 - World: (-52,64,132), Chunk: (at 12,4,4 in -4,8; contains blocks -64,0,128 to -49,255,143), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 5569 game time, 5569 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 84 total; [EntityCreeper['Creeper'/4096, l='MpServer', x=163.50, y=18.00, z=-365.50], EntityCreeper['Creeper'/4097, l='MpServer', x=159.50, y=18.00, z=-362.50], EntitySkeleton['Skeleton'/4099, l='MpServer', x=166.19, y=18.00, z=-366.66], EntitySkeleton['Skeleton'/2820, l='MpServer', x=156.50, y=27.00, z=-360.50], EntityBat['Bat'/3889, l='MpServer', x=99.47, y=12.53, z=-440.25], EntityZombie['Zombie'/4659, l='MpServer', x=35.50, y=55.00, z=-427.50], EntityBat['Bat'/2612, l='MpServer', x=51.44, y=49.59, z=-424.41], EntityZombie['Zombie'/4660, l='MpServer', x=34.50, y=55.00, z=-428.50], EntityRabbit['Rabbit'/826, l='MpServer', x=141.50, y=71.00, z=-426.50], EntityRabbit['Rabbit'/827, l='MpServer', x=138.34, y=72.00, z=-427.66], EntityRabbit['Rabbit'/828, l='MpServer', x=136.34, y=72.00, z=-427.66], EntityZombie['Zombie'/3139, l='MpServer', x=154.50, y=20.00, z=-324.50], EntityZombie['Zombie'/3140, l='MpServer', x=154.50, y=20.00, z=-325.50], EntityZombie['Zombie'/3141, l='MpServer', x=150.50, y=20.00, z=-322.50], EntityZombie['Zombie'/3142, l='MpServer', x=156.44, y=20.00, z=-324.06], EntityZombie['Zombie'/2376, l='MpServer', x=128.47, y=37.00, z=-366.81], EntityCreeper['Creeper'/2377, l='MpServer', x=129.06, y=38.00, z=-367.66], EntitySkeleton['Skeleton'/4426, l='MpServer', x=149.53, y=12.00, z=-461.66], EntitySpider['Spider'/2891, l='MpServer', x=160.69, y=40.09, z=-417.31], EntitySquid['Squid'/2898, l='MpServer', x=97.00, y=61.41, z=-403.77], EntitySquid['Squid'/2900, l='MpServer', x=100.53, y=58.30, z=-399.57], EntitySquid['Squid'/2901, l='MpServer', x=101.89, y=60.17, z=-386.47], EntitySquid['Squid'/2902, l='MpServer', x=102.47, y=57.00, z=-391.50], EntityBat['Bat'/4955, l='MpServer', x=153.43, y=17.07, z=-438.28], EntityCreeper['Creeper'/3932, l='MpServer', x=147.56, y=26.00, z=-459.94], EntityCreeper['Creeper'/3938, l='MpServer', x=97.50, y=18.00, z=-354.50], EntityCreeper['Creeper'/2147, l='MpServer', x=49.50, y=51.00, z=-342.50], EntitySkeleton['Skeleton'/3939, l='MpServer', x=95.50, y=18.00, z=-355.50], EntitySkeleton['Skeleton'/4966, l='MpServer', x=159.50, y=18.00, z=-363.50], EntitySkeleton['Skeleton'/4967, l='MpServer', x=157.50, y=18.00, z=-364.50], EntityBat['Bat'/3433, l='MpServer', x=147.27, y=11.30, z=-340.73], EntityBat['Bat'/3434, l='MpServer', x=144.89, y=12.05, z=-343.34], EntityPlayerSP['Player824'/288, l='MpServer', x=87.13, y=81.00, z=-381.85], EntityZombie['Zombie'/4208, l='MpServer', x=34.50, y=40.00, z=-334.50], EntityZombie['Zombie'/2673, l='MpServer', x=50.50, y=34.00, z=-424.50], EntitySkeleton['Skeleton'/3953, l='MpServer', x=21.94, y=25.00, z=-306.06], EntityWitch['Witch'/3186, l='MpServer', x=56.50, y=44.00, z=-421.50], EntitySpider['Spider'/3954, l='MpServer', x=19.91, y=25.00, z=-308.09], EntitySpider['Spider'/2674, l='MpServer', x=13.50, y=11.00, z=-376.50], EntityCreeper['Creeper'/3187, l='MpServer', x=47.50, y=44.00, z=-421.50], EntityZombie['Zombie'/2936, l='MpServer', x=112.50, y=17.00, z=-352.50], EntityZombie['Zombie'/2937, l='MpServer', x=113.81, y=16.00, z=-351.25], EntityZombie['Zombie'/3196, l='MpServer', x=33.50, y=35.00, z=-428.50], EntityItem['item.item.seeds'/386, l='MpServer', x=43.13, y=63.00, z=-357.88], EntityRabbit['Rabbit'/387, l='MpServer', x=34.50, y=68.00, z=-334.50], EntityRabbit['Rabbit'/388, l='MpServer', x=32.13, y=66.00, z=-330.88], EntityRabbit['Rabbit'/389, l='MpServer', x=32.75, y=66.00, z=-330.25], EntityCow['Cow'/1929, l='MpServer', x=111.50, y=65.00, z=-448.50], EntityCow['Cow'/1930, l='MpServer', x=113.50, y=66.00, z=-449.50], EntityCow['Cow'/1931, l='MpServer', x=115.50, y=66.00, z=-450.50], EntityCow['Cow'/1932, l='MpServer', x=115.50, y=66.00, z=-446.50], EntityChicken['Chicken'/1933, l='MpServer', x=100.47, y=64.00, z=-452.53], EntityChicken['Chicken'/1934, l='MpServer', x=104.50, y=65.00, z=-442.50], EntityChicken['Chicken'/1935, l='MpServer', x=108.50, y=65.00, z=-449.50], EntityChicken['Chicken'/1936, l='MpServer', x=109.50, y=65.00, z=-449.50], EntityCow['Cow'/406, l='MpServer', x=49.13, y=86.00, z=-402.06], EntityCow['Cow'/407, l='MpServer', x=43.88, y=83.00, z=-397.59], EntityCow['Cow'/408, l='MpServer', x=44.50, y=83.00, z=-394.50], EntityCow['Cow'/409, l='MpServer', x=44.50, y=88.00, z=-392.50], EntityZombie['Zombie'/3737, l='MpServer', x=91.28, y=11.06, z=-455.56], EntityBat['Bat'/5793, l='MpServer', x=66.75, y=35.10, z=-397.75], EntityCreeper['Creeper'/3509, l='MpServer', x=39.50, y=82.00, z=-373.50], EntityItem['item.item.seeds'/5064, l='MpServer', x=65.28, y=64.00, z=-362.81], EntitySquid['Squid'/5070, l='MpServer', x=39.81, y=60.75, z=-353.53], EntitySquid['Squid'/5071, l='MpServer', x=46.47, y=60.19, z=-347.03], EntityCreeper['Creeper'/3024, l='MpServer', x=153.50, y=24.00, z=-375.50], EntitySquid['Squid'/5072, l='MpServer', x=36.47, y=61.00, z=-350.34], EntityCreeper['Creeper'/3025, l='MpServer', x=156.50, y=24.00, z=-377.50], EntityEnderman['Enderman'/3795, l='MpServer', x=41.50, y=55.00, z=-432.50], EntityZombie['Zombie'/4315, l='MpServer', x=142.50, y=13.00, z=-443.50], EntitySkeleton['Skeleton'/3550, l='MpServer', x=91.50, y=23.00, z=-455.50], EntitySkeleton['Skeleton'/3552, l='MpServer', x=78.50, y=23.00, z=-458.16], EntitySkeleton['Skeleton'/3297, l='MpServer', x=28.16, y=25.00, z=-309.75], EntityZombie['Zombie'/744, l='MpServer', x=70.50, y=34.00, z=-312.50], EntitySkeleton['Skeleton'/745, l='MpServer', x=67.50, y=34.00, z=-316.50], EntityZombie['Zombie'/746, l='MpServer', x=70.50, y=34.00, z=-309.50], EntityBat['Bat'/3821, l='MpServer', x=162.75, y=15.66, z=-452.50], EntityRabbit['Rabbit'/494, l='MpServer', x=105.50, y=63.00, z=-398.50], EntitySkeleton['Skeleton'/2287, l='MpServer', x=109.50, y=18.00, z=-351.50], EntityRabbit['Rabbit'/495, l='MpServer', x=103.94, y=64.00, z=-401.88], EntityRabbit['Rabbit'/496, l='MpServer', x=109.53, y=66.00, z=-399.81], EntityRabbit['Rabbit'/2037, l='MpServer', x=109.78, y=65.00, z=-457.59], EntityCreeper['Creeper'/3574, l='MpServer', x=89.50, y=17.00, z=-459.50], EntityCreeper['Creeper'/3582, l='MpServer', x=48.50, y=55.00, z=-427.50]]
Retry entities: 0 total; []
Server brand: vanilla
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:390)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2782)
at net.minecraft.client.Minecraft.run(Minecraft.java:458)
at net.minecraft.client.main.Main.main(Main.java:113)
at Start.main(Start.java:11)
-- System Details --
Details:
Minecraft Version: 1.8.9
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_251, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 837748936 bytes (798 MB) / 1532493824 bytes (1461 MB) up to 3806855168 bytes (3630 MB)
JVM Flags: 0 total;
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
Launched Version: mcp
LWJGL: 2.9.4
OpenGL: GeForce GTX 1660/PCIe/SSE2 GL version 4.6.0 NVIDIA 445.75, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.
Using VBOs: No
Is Modded: Very likely; Jar signature invalidated
Type: Client (map_client.txt)
Resource Packs:
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 4x Intel(R) Core(TM) i5-6400 CPU # 2.70GHz
EDIT: It works when passing the Minecraft instance to the function

This is easy: You are facing a NullPointerException which means you are trying to use something that has no value assigned.
I would guess that
this.gameSettings
either does not exist or has no value assigned yet, which means it is null. That is causing the NullPointerExcepting resulting in a crash.
You probably need to write
this.gameSettings = gs;
or just use gs if possible. Both should work.
Good luck :)

Related

Missing out endpoint for a relay

Connecting to a usb-relay (https://www.amazon.de/ARCELI-SRD-05VDC-SL-C-Relaismodul-steuerschalter-intelligente/dp/B07J2PY13G/ref=sr_1_15?crid=1OQO4UWC6499D&keywords=usb+relais+5v&qid=1647548932&sprefix=usb+relais%2Caps%2C179&sr=8-15) from a windows 10 pc I only get information of existing IN-ENDPOINT.
But I am missing the OUT-ENDPOINT.
What did I wrong ?
I installed 3 drivers via libusbK-3.1.0.0-setup.exe:
WinUsb v6.1.7600.16385 (04/09/2017)
libusbK v3.0.7.0 (07/19/2021)
libusb0 v1.2.6.0 (06/17/2021)
Using a python-script
import usb.core
import usb.util
dev = usb.core.find(idVendor=0x16C0, idProduct=0x05DF)
if dev is None:
raise ValueError('Device not found')
dev.set_configuration()
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]
print ('cfg ',cfg)
ep = usb.util.find_descriptor(
intf,
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
print ('ENDPOINT ',ep)
I got
cfg CONFIGURATION 1: 20 mA ===================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x22 (34 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0x80 Bus Powered
bMaxPower : 0xa (20 mA)
INTERFACE 0: Human Interface Device ====================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x1
bInterfaceClass : 0x3 Human Interface Device
bInterfaceSubClass : 0x0
bInterfaceProtocol : 0x0
iInterface : 0x0
ENDPOINT 0x81: Interrupt IN ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x8 (8 bytes)
bInterval : 0x14
ENDPOINT-OUT: None

No data received form USB device

I'm implementing USB web cam on top of Atmega32U4.
I think I managed to implement transactions on the control endpoint, more or less correctly, as all the descriptors are transited and device reports correctly in the system.
Issue is when I'm trying to send video data out of the device, as nothing seems to go through.
The way I implemented data transmission (according to section 22.14 of datasheet) is as follows:
while (len > 0) {
while (1) {
cli();
_select_endpoint(VIDEO_STREAMING_ENDPOINT);
if (bit_is_set(UEINTX, TXINI) && bit_is_set(UEINTX, FIFOCON))
break;
sei();
_delay_ms(1);
}
_clear_TXINI();
while (bit_is_set(UEINTX, RWAL) && len > 0) {
UEDATX = *buff++;
--len;
}
_clear_FIFOCON();
sei();
}
When debugging this I noticed that bank is filled with data during the first loop, but data is not transmitted to the host. It is looping forever in the TXINI,FIFOCON part. Nothing, except the control requests, is shown in the Wireshark. I'm not sure if I missconfigured something on the MCU registers, so it is not sending data to the host upon the request, or in the descriptors, status, etc, so host is not asking for data.
What might have I messed up?
lsusb -v
Bus 001 Device 077: ID 6431:deb2 majkrzak majkrzak
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 32
idVendor 0x6431
idProduct 0xdeb2
bcdDevice 0.00
iManufacturer 1 majkrzak
iProduct 1 majkrzak
iSerial 1 majkrzak
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x00a0
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 1 majkrzak
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 1 majkrzak
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 1
iInterface 1 majkrzak
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.50
wTotalLength 0x0028
dwClockFrequency 16.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 2
iTerminal 1 majkrzak
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x00000000
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0101 USB Streaming
bAssocTerminal 1
bSourceID 1
iTerminal 1 majkrzak
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 1
iInterface 1 majkrzak
VideoStreaming Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 1
wTotalLength 0x0055
bEndpointAddress 0x81 EP 1 IN
bmInfo 0
bTerminalLink 2
bStillCaptureMethod 0
bTriggerSupport 0
bTriggerUsage 0
bControlSize 0
bmaControls( 0) 27
VideoStreaming Interface Descriptor:
bLength 27
bDescriptorType 36
bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED)
bFormatIndex 1
bNumFrameDescriptors 1
guidFormat {32595559-0000-0010-8000-00aa00389b71}
bBitsPerPixel 8
bDefaultFrameIndex 0
bAspectRatioX 1
bAspectRatioY 1
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 38
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 1
bmCapabilities 0x02
Still image unsupported
Fixed frame-rate
wWidth 16
wHeight 16
dwMinBitRate 262144
dwMaxBitRate 262144
dwMaxVideoFrameBufferSize 768
dwDefaultFrameInterval 1000000
bFrameIntervalType 0
dwMinFrameInterval 1000000
dwMaxFrameInterval 1000000
dwFrameIntervalStep 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 1
Device Status: 0x0000
(Bus Powered)
edit
I'd made a simple script with pyusb which is pulling data from the endpoint and it works. Wireshark is showing the transactions, so it means that in the uvcvideo case data is not pulled at all. Definitely I messed up the descriptors then.
The reason why uvc driver is not pulling any data for the device, is that you set dwMaxVideoFrameSize and dwMaxPayloadTransferSize to 0. Set it to value high enough for your case and it will work.

Bytebuddy constructor advice throws java.lang.VerifyError

Basically, I want to intercept all classes that have a specific annotation (that was created by me) and i want to perform my custom logic in method and constructor entry.
I have tried using byte-buddy agent builder as you can see from my code sample.
public static void agentmain(final String agentArgs,
final Instrumentation inst) {
new AgentBuilder.Default()
.type(ElementMatchers.
<TypeDescription>isAnnotatedWith(Licensable.class))
.transform((builder, td, cl, m) -> builder
.visit(Advice.to(AdviceToClasses.class).on(isMethod()))
.visit(Advice.to(AdviceToConstructor.class).on(isConstructor())))
.installOn(inst);
}
AdviceToConstructor class
#Advice.OnMethodEnter
public static void enter(#Advice.Origin Constructor method) throws
Exception {
System.out.println("Intercepted Constr >> " + method);
}
Using above, i can get what i expected if use method advice and leave out constructor part. But when i use constructor part, it doesn't go to advice enter method and i get the below errors.
complete --- sample.TestAnnotation
complete --- java.lang.VerifyError
Exception in thread "main" complete --- java.lang.Throwable$WrappedPrintStream
complete --- java.lang.Throwable$PrintStreamOrWriter
complete --- java.util.IdentityHashMap$KeySet
java.lang.VerifyError: Inconsistent stackmap frames at branch target 96
Exception Details:
Location:
sample/TestAnnotation.()V #96: aload_0
Reason:
Type uninitializedThis (current frame, locals[0]) is not assignable to 'sample/TestAnnotation' (stack map, locals[0])
Current Frame:
bci: #93
flags: { flagThisUninit }
locals: { uninitializedThis, 'sample/annotation/Licensable' }
stack: { }
Stackmap Frame:
bci: #96
flags: { }
locals: { 'sample/TestAnnotation' }
stack: { }
Bytecode:
0x0000000: b200 02bb 0028 59b7 0029 122b b600 2f12
0x0000010: 0703 bd00 31b6 0035 b600 38b6 003c b600
0x0000020: 04b2 0002 123e b600 0412 0703 bd00 31b6
0x0000030: 0035 b600 4412 46b6 004a c000 464c 2bc6
0x0000040: 001e b200 502b b900 5301 00b6 0059 3d1c
0x0000050: 9a00 0dbb 005b 5912 5db7 005f bfa7 0003
0x0000060: 2ab7 0001 b1
Stackmap Table:
append_frame(#93,Object[#70])
full_frame(#96,{Object[#7]},{})
at sample.Sample.main(SampleApp.java:47)
complete --- java.util.IdentityHashMap$KeyIterator
complete --- java.util.IdentityHashMap$IdentityHashMapIterator
I checked the posts on StackOverflow and googled it but couldn't find a solution. Any advice regarding this error?

SparkFun nRF52832 Breakout + SPI display

I'm using the TFT display ILI9341 linked to the Adafruit HUZZAH through SPI with the example skecth provided "graphictest" and everythings works fine.
// HUZZAH DEVICE Spakfun nRf52
// Violet -- 12 --> MISO <-- 12 -- Violet
// Rouge -- 3V --> LED <-- 3V3-- Orange
// Vert -- 14 --> SCK <-- 13 -- Vert
// Bleu -- 13 --> MOSI <-- 11 -- Bleu
// Blanc #-- 4 --> D/C <-- 9 -- Marron
// Bleu -- 3V --> RESET <-- 3v3-- Gris
// Blanc o-- 5 --> CS <-- 10 -- Jaune
// Noir -- GND--> GND <-- GND-- Noir
// Rouge -- 3V --> VCC <-- 3V3-- Vcc
I want to do the same things with the SparkFun nRF52832 Breakout but the sketch stop during "tft.begin()"
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
Serial.begin(9600);
Serial.println("ILI9341 Test!");
tft.begin();
I also checked the header : variant.h
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (12)
#define PIN_SPI_MOSI (11)
#define PIN_SPI_SCK (13)
static const uint8_t SS = 10 ;
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
I try to use SDcard slot built-in on the ILI9341 display, it's fine with HUZZAH but KO with Sparkfun nRf52.
If some of you could help me, it would be very kind.
Thanks.

Spark CodeGenerator failed to compile, got NPE, infrequently

I'm doing simple spark aggregation operation, reading data from avro file as dataframe and then mapping them to case-classes using rdd.map method then doing some aggregation operation, like count etc.
Most of the time it works just fine. But sometimes it generating weird CodeGen exception;
[ERROR] 2017-03-24 08:43:20,595 org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator logError - failed to compile: java.lang.NullPointerException
/* 001 */ public java.lang.Object generate(Object[] references) {
/* 002 */ return new SpecificUnsafeProjection(references);
/* 003 */ }
/* 004 */
/* 005 */ class SpecificUnsafeProjection extends org.apache.spark.sql.catalyst.expressions.UnsafeProjection {
I am using this code;
val deliveries = sqlContext.read.format("com.databricks.spark.avro").load(deliveryDir)
.selectExpr("FROM_UNIXTIME(timestamp/1000, 'yyyyMMdd') as day",
"FROM_UNIXTIME(timestamp/1000, 'yyyyMMdd_HH') as hour",
"deliveryId"
)
.filter("valid = true").rdd
.map(row => {
val deliveryId = row.getAs[Long]("deliveryId")
val uid = row.getAs[Long]("uid")
val deviceModelId: Integer = if(row.getAs[Integer]("deviceModelId") == null) {
0
} else {
row.getAs[Integer]("deviceModelId")
}
val delivery = new DeliveryEvent(deliveryId, row.getAs[Integer]("adId"), row.getAs[Integer]("adSpaceId"), uid, deviceModelId)
eventCache.getDeliverCache().put(new Element(deliveryId, delivery))
new InteractedAdInfo(row.getAs[String]("day"), delivery.deliveryId, delivery.adId, delivery.adSpaceId, uid, deviceModelId, deliveryEvent=1)
})
deliveries.count()
I can't regenerate the problem. But i get it irregularly in production. I'm using from java-app and taking spark-core_2.11:2.1.0 and spark-avro_2.11:3.1.0 maven co-ordinates.
Where might be the problem, i'm setting java -Xms8G -Xmx12G -XX:PermSize=1G -XX:MaxPermSize=1G while running the app.
I'm seeing a similar error with the very simple action spark.read.format("com.databricks.spark.avro").load(fn).cache.count, which is intermittent when applied to large AVRO files (4GB-10GB range in my tests). However, I can eliminate the error removing the setting --conf spark.executor.cores=4 and letting it default to 1.
WARN TaskSetManager: Lost task 58.0 in stage 2.0 (TID 82, foo.com executor 10): java.lang.RuntimeException:
Error while encoding:
java.util.concurrent.ExecutionException:
java.lang.Exception: failed to compile: java.lang.NullPointerException
/* 001 */ public java.lang.Object generate(Object[] references) {
/* 002 */ return new SpecificUnsafeProjection(references);
/* 003 */ }